Games-Go-Sgf2Dg
view release on metacpan or search on metacpan
lib/Games/Go/Sgf2Dg.pm view on Meta::CPAN
$been_here->{"$x,$y"} = 1; # mark that we've been here
my $thisStone = $diagram->game_stone(Coords2SGF($x, $y));
return 1 unless(defined($thisStone)); # empty, the group has liberties
return(0) if ($thisStone ne $color); # this is an opponents stone - no liberties here!
# this is a connected stone of the same color
$depth++;
if (HasLibs($x + 1, $y, $color, $been_here, $depth) or
HasLibs($x - 1, $y, $color, $been_here, $depth) or
HasLibs($x, $y + 1, $color, $been_here, $depth) or
HasLibs($x, $y - 1, $color, $been_here, $depth)) {
return(1); # yes! we're alive!
}
return(0); # uh-oh! no liberties yet...
}
sub RemoveGroup {
my ($x, $y, $color) = @_;
my $thisStone = $diagram->game_stone(Coords2SGF($x, $y));
if (defined($thisStone) and
($thisStone eq $color)) {
B 26. Must be at B15.
B 42. Even in isolation this is bad. B must connect at K5.
B 60. Bad tenuki.
B 80. Having played well on the bottom, B must continue at L2.
B 92. Pointless.
B 102. Due to an OWL mistake, B thinks the corner is alive. It can of
course be attacked at S1. B sees that R1 threatens O1, and due to
a missing pattern believes there is another half eye around O5.
B 120 and 126. Pointless moves.
By move 155 W must think he has a won game.
}
\bigbreak
\centerline{\hglue-20pt\epsffile{figure5.1.eps}}
( run in 2.223 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )