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 $scorable->transanimate([0,4]); # equivelent: $scorable->deanimate([0,4]); my %dead_stones = $scorable->dead; say "black: $dead_stones{b}, white: $dead_stones{w}"; # black: 3, white: 0 # $scorable->reanimate([0,4]); # equivelent: $scorable->transanimate([0,4]); # score black: 1, white: 2
The status of each node is one of the following categories: 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.
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.
not implemented. Further research is needed.
I think that this covers all categories related to score negotiation for different scoring regimes.
head1 TERMINOLOGY
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
Returns a nodeset of stone of $color, which have been deanimated
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.
To install Games::Go::Cinderblock, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Go::Cinderblock
CPAN shell
perl -MCPAN -e shell install Games::Go::Cinderblock
For more information on module installation, please visit the detailed CPAN module installation guide.