Zach Morgan
and 1 contributors


Games::Go::Cinderblock::Scorable - An abstract state of endgame score negotiation


   my $rulemap = Games::Go::Cinderblock::Rulemap::Rect->new( h=>2, w=>5 );
   my $board = [
      [qw/0 w 0 b b/],
      [qw/0 w w b 0/],
   my $state_to_score = Games::Go::Cinderblock::State->new(
      rulemap  => $rulemap,
      turn => 'b',
      board => $board,
   my $scorable = $state_to_score->scorable;
   my %score = $scorable->score;
   say "black: $score{b}, white: $score{w}";
   # black: 1, white: 2
   # equivelent: $scorable->deanimate([0,4]);
   my %dead_stones = $scorable->dead;
   say "black: $dead_stones{b}, white: $dead_stones{w}";
   # black: 3, white: 0
   # equivelent: $scorable->transanimate([0,4]);
   # score black: 1, white: 2


The status of each node is one of the following categories: categories:

Stone-occupied node categories:


The initial state.


A scorable must be told what stones are dead.


not implemented. Maybe the stones are alive in seki? dunno how to mark seki.

stoneless node categories:


considering stones that are known to be dead, this area is known to be alive.


Surrounded by stones that may be deanimated.


the region is bounded by stones of more than one color.

seki territory?

not implemented. Further research is needed.

I think that this covers all categories related to score negotiation for different scoring regimes.

chinese rules -- alive stones are a point each.
japanese rules -- no territory in seki.


deanimate -- To set as dead, to kill
reanimate -- To set as alive, to revive
animation -- the life/death state of a stone, chain, group, or any (in)?animate object
transanimate -- to animate xor deanimate something, to to toggle the life/death state



Returns a Games::Go::Cinderblock::NodeSet of contiguous empty regions bounded by multiple colors.


Returns a nodeset of known & perceived territory.

Excludes nodes occupied by dead stones of the opposite color

dead ($color)

Returns a nodeset of stone of $color, which have been deanimated

alive ($color)

Returns a nodeset of nodes with stones of $color, which have not been deanimated. Alive is the default state.


$node must be occupied with a stone.

This marks a stone as dead, and the region bounded by stones of the opposite color is now known territory of the opposite color. Contained nodes of the same color as $node are also marked as dead.


Opposite of deanimate($node)


Either reanimates or deanimates at $node. Does nothing if $node is empty.


Empty regions are initially either dame or derived territory. marking a stone as dead has the effect of converting dame/derived to known for the region bounded by stones of the opposite color. reanimating dead stones returns its adjacent empty nodes to dame. alive stones adjacent to known territory can not be deanimated.


Each category has a hash attribute in the scorable object. they are divided into colors, where each color of that cat has a B::NodeSet. the cats are named _alive, _dead, _known_terr, _derived_terr, _dame, maybe _seki later. each transanimation initiates a floodfill to discover the boundry of its the region bordered by the opposite color.

The dame category is an exception. there is no color specified.