Race To Capture: Analyzing Semeai in Go
Race To Capture: Analyzing Semeai in Go
Martin M
uller
Tsukuba, Japan
analysis as for the endgame [3, 5]: identication eye has only one surrounding block, and all
of safe blocks and territories [4], followed by a par- empty points inside are adjacent to that block.
tition of the rest of the board into connected com- This denition is broader than the usual one,
ponents called . Each local game, con- and includes cases where the surrounded re-
local games
sisting of empty points, plus possibly unsafe stones gion will end up as more or less than one eye.
of either player, can potentially become a semeai. Unknown area Area that cannot be classied as
This holds even if the area is currently completely outside liberties, shared liberties, or eye.
empty or contains stones of only one player.
To be able to evaluate semeai statically, much
more restrictive conditions must be satised. Such 2.3 Eye Status and Liberty Count
conditions will be discussed in section 3.
2.2 Classication of Blocks and
Empty Points
Classication of points in a local game is a rst
step in identifying semeai. In each local game, we
recognize the following types of blocks of stones and
empty points:
Essential block A block of black or white stones Figure 2: Basic nakade shapes
which must be saved from capture. Captur-
ing an essential block immediately decides a An eye area is called a if the opponent can
semeai. nakade
ll all but one of its points by one of the basic
Nonessential block Block which can be cap- nakade shapes shown in Figure 2.
tured without losing the semeai. An example In semeai, small eyes with size from 1 to 3 be-
of a nonessential block is a small block con- have in the same way, while larger eyes are stronger
tained in the opponent's eye, such as the single both in terms of providing more liberties than their
white stone in Figure 3. size and in having an advantage in semeai against
smaller eyes. We model this behavior by an eye
Unknown block Contains all remaining blocks status . For each eye size, Table 1 shows the status
that cannot be classied as either essential or and the number of liberties. For 0 m < n 7, a
2
Size 0 1 2 3 4 5 6 7 For semeai of classes 3 or higher, use
4 Search
Status 0 1 1 1 4 5 6 7 search to nd the outcome.
Liberties 0 1 2 3 5 8 12 17
5 Move Generation for Semeai Play Using
the results of search or static evaluation,
generate moves to play each semeai on the
Table 1: Eye status and liberties board. Use exact combinatorial game values
when available, and a heuristic temperature
n point nakade shape lled by opponent stones is
m
estimate otherwise.
equivalent to ( 0 3 ) 2+3 0 outside liberties.
n
2 n = m
A nakade shape is unsettled if it has not yet been 2.5 A Classication of Semeai
reduced to only one eye, and the defender can still The following classication proceeds from simple
make two eyes there. Figure 4 shows an example. semeai that can be analyzed statically to cases with
less structure, which require more and more search
2.4 Steps of a Semeai Algorithm to solve.
The following steps are a general outline of a semeai Class 0 Exactly one of each color,
solving algorithm. Some details are discussed in only plain
essential block
external and plain shared liberties,
later sections. no eyes.
1 Board Partition Find safe blocks of stones and Class 1 One essential block of each color, may
territories. Partition the rest of the board into have one potentially containing one
connected components, called local games . plain eye
opponent nonessential block in a nakadeshape.
2 Semeai Identication Investigate which local
games are semeai candidates by the following Class 2 Like .
class 1, but eyes include unsettled
substeps. nakade
2.1 Eye Recognition Subdivide each local game Class 3 Non-plain eyes and/or external liberties
into regions surrounded by stones of a which can be proven by search to be equivalent
single
player. Test each such region whether it is a to some plain eye/liberty region.
plain eye for that player. Class 4 General eyes and/or liberty regions. More
2.2 Liberty Regions After nding blocks and complicated values of regions, for example re-
eye regions, divide the rest of a local game into gions that allow to gain or lose more than 1
liberty regions surrounded by stones of liberty by a move. Regions with unsettled
eye status: players can make or prevent eye(s)
both
players. Classify liberty regions as outside lib-
erties, shared liberties, or unknown. there.
2.3 Block Classication Classify blocks as es- Class 5 Additional unsafe blocks in liberty re-
sential blocks, nonessential blocks, and un- gions. Connect, cut these blocks to
known blocks. gain/reduce liberties. However, these blocks
are not adjacent to opponent's essential block.
2.4 Semeai Safety Test For each color, deter-
mine if winning the semeai would ensure the Class 6 More than one essential block per player,
safety of all essential blocks. but they form a chain. Cutting the chain wins
the semeai for the opponent.
2.5 Semeai Classication Determine which se-
meai class the local game belongs to. Class 7 General semeai in completely surrounded
3 Static Evaluation For semeai of classes 0 to 2,
local game.
statically evaluate the semeai to nd its status Class 8 Local area not completely surrounded by
and its combinatorial game evaluation. safe stones.
3
Figure 3: Class 1 semeai: plain eyes Figure 5: Class 3 and 4 semeai: non-plain liberty
at `a', non-plain eye space
blocks, in contrast to the situation in the previ- of the number of outside liberties, plus the liberty
4
F . If 1 , attacker is 1 0 moves ahead in the
> F F
in the semeai.
Figure 7: Class 7 and class 8 semeai: completely The outcome of the semeai can be summed up by
surrounded and open-ended area two numbers: Semeai status measures how many
moves the winner is ahead in the ght. Positive
values are good for Black, negative values are good
for White. If the semeai status is 0, the outcome
is either unsettled, or seki. SekiLevelis dened
only if semeai status is 0, and measures how many
consecutive moves the stronger side can make be-
fore the outcome changes from seki to unsettled.
Figure 8: Counting liberties If sekiLevel = 0, the outcome is unsettled, if
sekiLevel > 0 it is a seki. The following code frag-
count of the players eye (if there is one). For exam- ment computes semeai status and sekiLevel, deter-
ple, in Figure 8 the black block has 0 outside lib- mines whether the semeai is unsettled and com-
erties plus 8 0 1 = 7 liberties from a ve point eye putes the winner.
containing one opponent stone, so B = 0 + 7 = 7.
L
// input: betterEye, 1, 1BW = LB 0 LW , F
The white block has 6 outside liberties plus 5 lib- // output: semeaiStatus, sekiLevel, isUnsettled, winner
erties from a four point eye containing 0 opponent if (betterEye == none) // same eye status: may be seki
f if (1 F )
stones, for a total of W = 6+5 = 11 own liberties.
L f semeaiStatus = 0; sekiLevel = F - 1;
The number of shared liberties = 2. S
g
else
If the eye status of players is dierent, then the semeaiStatus = 1BW + ((1BW > 0)? -F : F);
player with poorer eye status must be the attacker. g
else // dierent eye status: never seki
If both have equal eye status, and one player has a f semeaiStatus = 1BW ;
surplus of own liberties, that player is the attacker. g
semeaiStatus += (betterEye == Black) ? F : -F;
If both eye status and liberty count are equal then isUnsettled = (sekiLevel == 0) && semeaiStatus == 0;
either player can be the attacker. Set 1 = B 0 W L L
winner = (semeaiStatus == 0) ? none :
(semeaiStatus > 0) ? Black : White;
if Black is the attacker and 1 = W 0 B otherwise.
L L
The number of forced liberties F is the number 3.2 Semeai and the Safety of Stones
of shared liberties that attacker has to ll to put and Territories: When Winning
defender into atari. If defender has an eye, or there the Semeai Loses the Fight
are no shared liberties ( = 0), then = . If
S F S
Furthermore, attacker needs to play only if 1 = capture fails to secure the black stones, and they
5
Figure 9: Snapback and oi-otoshi Figure 12: Another hidden nakade shape
every shared liberty and every opponent external value, the dierence between the opponent winning
liberty counts as one point. Every opponent stone in one move and winning by lling a number of lib-
counts as two points. From the sum of these values, erties. The game value also changes accordingly.
subtract the number of necessary defensive moves. We have implemented the necessary modications
Finally, the sign of the total score is +1 for Black in our program, but lack space to show the details
and -1 for White. here.
j (
W innerScore player )j = + ( )
shared ext opp 4 Solving Other Semeai
+2 2 ( )0
stones opp (
Def ensiveM oves player ) We have implemented static evaluation for class
The number of necessary defensive moves, 2 semeai, and a search method for classes 3 and
, is a nonnegative value, the
De-
higher. Again, because of a lack of space we must
fensiveMoves(player)
minimum of two values: the number of moves re- postpone a detailed description of these methods to
quired to capture the opponent, and the number of a future technical report. A few examples of semeai
moves the player has to make to remain ahead in search and some preliminary results are contained
the semeai if the opponent lls all outside liberties. in a previous paper [6].
4.1 Class 2 Semeai: Unsettled Eye
(
Def ensiveM oves player )= max (0 ;
Class 1 semeai are not `closed' under play: during
( (
min ext player )+10j semeaiStatus ; j play, if nakade stones are captured, an unsettled
( )+
libs opp shared )) eye shape such as the one in Figure 4 can result,
7
so the semeai classication changes to class 2 for Explorer against two of the recent world cham-
one move. A single player's unsettled eye shape pion programs, Many Faces and Go 4++ . Ex-
can be handled similarly to the case of a group in plorer won most test games by large margins, of-
atari mentioned above. Further rare special cases ten gaining more than 100 points over the game-
can occur: One player can be doubly unsettled: theoretic outcome. Detailed results are given
the player's group is in atari, and the opponent in [6]. The test positions and game records in
can live in an unsettled eye shape. In this case SGF format are also accessible through the in-
the player has lost without further moves (unless ternet at http://www.etl.go.jp/etl/suiron/~muel-
the opponent is also in atari). If both players are ler/cgo/semeai.html. From this experiment, it is
unsettled because of an unsettled eye and/or atari, clear that our method is able to evaluate semeai
players must decide between attack and defense, much earlier and much more precisely than the
depending on the scores and outcomes that would other tested programs.
result.
References
In Figure 15 Black can make seki, while White [3] M. Muller. Computer Go as a Sum of Lo-
can live with 9 points against Black's 5. The game cal Games: An Application of Combinatorial
value is 38j 3 jj 0 4j 0 453, a 4 point double sente Game Theory . PhD thesis, ETH Zurich, 1995.
play in classical endgame terminology. Diss.Nr.11.006.
[4] M. Muller. Playing it safe: Recognizing secure
5 Test Examples: Full Board territories in Computer Go by using static rules
Semeai Problems
and search. In H. Matsubara, editor, Proceed-
ings of the Game Programming Workshop in
, pages 80{86, Computer Shogi As-
Japan '97
sociation, Tokyo, Japan, 1997.
[5] M. Muller. Decomposition search: A combina-
torial games approach to game tree search, with
applications to solving go endgames. In IJCAI-
, volume 1, pages 578{583, 1999.
99