0% found this document useful (0 votes)
237 views8 pages

Race To Capture: Analyzing Semeai in Go

The document presents a formal theory and algorithmic approach for analyzing capturing races, or semeai, in the game of Go. It begins by clarifying what constitutes a semeai and distinguishing it from other game phases. Key components of semeai instances are identified, including essential blocks, liberties, eyes, and different types of empty points. A nine-category classification of semeai is outlined. The paper focuses on developing methods for the static analysis of the simplest two semeai classes without search, and proves their solutions in terms of combinatorial game values. It also briefly discusses higher semeai classes that require search-based analysis.

Uploaded by

jkchromy945
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
237 views8 pages

Race To Capture: Analyzing Semeai in Go

The document presents a formal theory and algorithmic approach for analyzing capturing races, or semeai, in the game of Go. It begins by clarifying what constitutes a semeai and distinguishing it from other game phases. Key components of semeai instances are identified, including essential blocks, liberties, eyes, and different types of empty points. A nine-category classification of semeai is outlined. The paper focuses on developing methods for the static analysis of the simplest two semeai classes without search, and proves their solutions in terms of combinatorial game values. It also briefly discusses higher semeai classes that require search-based analysis.

Uploaded by

jkchromy945
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Race to Capture: Analyzing Semeai in Go

Martin M
uller

ETL Complex Games Lab

Tsukuba, Japan

[email protected]

September 10, 1999

Abstract might end up as a race to capture, and can be re-


solved by search. However, during the search it
Skill in analyzing capturing races, orsemeai , is an might turn out that the situation is not really a
important component of Go playing strength for semeai, because one side can make life, leaving the
both humans and computer programs. Techniques other side dead, or because both sides should de-
for analyzing semeai have been developed centuries fend themselves instead of attacking the other.
ago, and passed on among Go players. A number While this paper deals mainly with static analy-
of informal descriptions of the basic methods are sis of semeai, it thereby also provides a foundation
available in Go books. This paper starts develop- for ecient search-based algorithms.
ing a formal theory of semeai, leading to an algo- Section 1 clari es the term semeai, and its re-
rithm for basic semeai classes that has been tested lation to other tasks such as proving the safety
successfully against top Go programs. of territories and solving Life-and-Death (tsumego)
problems. Section 2 describes the components of
semeai such as essential blocks, liberties, and eyes,
gives the outline of a general algorithm to solve
semeai, and classi es semeai into nine categories.
Section 3 deals with the static analysis of the two
simplest semeai classes, describes how to recognize
Figure 1: Class 0 semeai: one essential block each, such semeai, and gives a complete solution in terms
plain outside liberties, shared liberties of combinatorial game values. The section also de-
scribes restrictions on which semeai can be stati-
cally recognized, and motivates why these restric-
tions are necessary by examples. Section 4 very
1 What is a Semeai? brie y deals with semeai classes 2 and higher, and
Section 5 shows some results on full board semeai
Figure 1 shows two simple cases of a semeai . A problems.
textbook-like de nition is "A race to capture be-
tween two adjacent groups that cannot both live". 1.1 Semeai and other Game Phases
Such a de nition may be good enough for humans,
but it is not suciently precise for implementing Semeai often occur as subproblems of another task,
semeai in a computer program. This paper gives such as proving the safety of stones and territory, or
both more narrow and more general de nitions of solving life and death problems. Examples include:
semeai. The narrower de nitions cover cases which keep a territory safe by winning a semeai against
can be detected and evaluated statically, without an intruder, rescue stones by cutting through a sur-
search. The more general de nitions are designed rounding wall and winning the semeai against some
to cover potential semeai, unclear situations which part of the wall, connecting stones by setting up a
1
lack of liberties for the opponent: if he or she tried nonessential blocks. Saving or capturing such
to cut, that would lead to a lost semeai. blocks has some priority as a heuristic, but it
Cases where blocks of both players have few lib- does not necessarily decide the semeai.
erties can be handled reasonably well with existing
capture search techniques. The methods presented Outside liberty An empty point that is a liberty
here are most useful in situations where blocks have of an essential block of one player, but not a
many liberties and/or large eyes. In such cases liberty of an essential opponent block. An out-
they are much more ecient than a purely tacti- side liberty is called plainif it is also adjacent
cal search. to a safe opponent block, so the opponent can
ll the liberty without making additional ap-
proach moves.
2 Describing Semeai In-
Shared liberty Common liberty of essential
stances blocks of both Black and White.
2.1 Finding Semeai Eye An area completely surrounded by essential
Perhaps surprisingly, identi cation of semeai in a blocks of one player. The area can contain
given Go position requires the same preliminary nonessential blocks of either player. A plain

analysis as for the endgame [3, 5]: identi cation 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 de nition 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 classi ed 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 satis ed. Such 2.3 Eye Status and Liberty Count
conditions will be discussed in section 3.
2.2 Classi cation of Blocks and
Empty Points
Classi cation 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 classi ed 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 Classi cation of Semeai
reduced to only one eye, and the defender can still The following classi cation 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 Identi cation 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 Classi cation 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 Classi cation 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

Figure 4: Class 2 semeai: unsettled nakade


Figure 6: Class 5 and 6 semeai: unknown block,
Figures 1 to 7 contain examples of each semeai more than one essential block
class. Figure 1 shows two class 0 semeai. On the
left, Black has one plain liberty region containing ous gure, where White could a ord to give up one
three plain liberties, and White has two plain lib- block yet win the main ght. Figure 7 shows a gen-
erty regions containing one liberty each. On the
right, White has one plain liberty, and there is one eral semeai of class 7 on the left, which lacks any
shared liberty region containing 3 liberties. of the special properties of classes 0-6. The semeai
In Figure 3 both Black and White have an eye. area is still completely surrounded by safe blocks.
Black's eye includes a white stone. This stone is Finally, the right side shows a class 8 semeai which
nonessential: Black should not try to capture it, does not have a complete surrounding wall. In such
and White can a ord to lose it without losing the a situation players must consider additional options
semeai. During the course of the semeai the eye such as trying to break out to the outside, or coun-
area will be occupied by nonessential stones and terattacking against the wall. Fixing the boundary
emptied by a capture several times. of the semeai becomes somewhat arbitrary.
Figure 4 shows an unsettled nakade shape. Black
must play in at `a' to prevent White from making 3 Static Semeai Analysis
two eyes. In Figure 5 on the left, the white lib-
erty region is not plain because the point `a' is not 3.1 Semeai Evaluation
adjacent to a surrounding opponent block. How-
ever, in semeai the area behaves like a plain three The traditional liberty-counting methods for se-
liberty area, a fact which can be proven by search. meai evaluation are known to many Go players. [1]
The right side picture shows an eye area that is not provides a detailed introduction, while [2] contains
plain, since the corner point is not adjacent to the a more concise summary. In our classi cation, the
black block. In this case the number of liberties is evaluation directly applies to semeai of class 0 and
dramatically reduced from 7 to 3. 1.
Figure 6 shows a class 5 semeai on the left, which
contains an additional white block. White can win 3.1.1 Who Wins, and by How Much?
the semeai among the essential blocks going rst,
but cannot save the marked block. In the class 6 To decide who wins a semeai, compute each player's
semeai on the right side, Black has two essential liberty count and eye status, as well as both players'
blocks which form a chain and can connect at `a' shared liberties.
or `b'. Black cannot give up either of the essential A player's liberty count, B or W , is the sum
L L

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

semeai and need not play immediately. If attacker


fails, there are two cases: if the eye status of players
is di erent, or the number of shared liberties is too
small, then attacker loses. Otherwise it is a seki,
in which the stronger side must play 0 1 moves
F

before it becomes unsettled. In the example, 1 >

F , so White wins and is 1 0 = 2 moves ahead


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 de ned
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 di erent, then the semeaiStatus = 1BW + ((1BW > 0)? -F : F);
player with poorer eye status must be the attacker. g
else // di erent 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

In the example, White is the attacker because of


poorer eye status (4 vs. 5), so 1 = W 0 B = 4.
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

defender has no eye and 0, = 0 1. In the


S > F S
3.2.1 Capture-Recapture Tactics
example Black has an eye, so = = 2.F S
In some cases, being the rst to capture the oppo-
The semeai formula compares the attacker's lib- nent does not prevent the player's stones from be-
erty surplus to the number of forced liberties: ing captured later. Examples of ,
The semeai formula: Attacker succeeds if
snapback oi-otoshi
and ishinoshita are shown in Figures 9 and 10. In
1 each of these examples, semeai analysis shows that
Black can capture White going rst. However, this
F:

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

Figure 10: Ishinoshita


will be captured when White again plays into the
empty region of the original white stones. Figure 13: 88 stone capture problem
has only one eye.
Figure 13 shows a classic problem composed by
Intetsu Akaboshi in the 18th century, in which
White captures a total of 88 black stones but still
dies. The problem starts o with a 16 stone capture
which leads to only one eye.
A related question is whether a nakade-like sit-
uation guarantees at least seki by two shared lib-
Figure 11: Hidden nakade shape erties for the player on the outside. In Figure 14,
blocks `A' are alive in seki, but blocks `B' are dead.
A general classi cation procedure for eye shapes is
3.2.2 Capture Does not Create Two Eyes beyond the scope of this paper.
For determining whether a capture will guarantee 3.2.3 Two Simple Rules for Ensuring
two eyes for a player, it is not enough to analyze the Safety
current shape of the opponent's stones. In Figure
11, the current shape of the white stones in the One of two simple static rules can often be ap-
corner is not a nakade, so Black might have some plied to ensure that winning the semeai will lead to
hope of living. However, White can create nakade safety. Rule 1 ensures safety by connection, Rule
at `a' any time, and Black cannot prevent it, so 2 by making a second eye for a group that already
Black is dead with only one eye. Figure 12 shows has one eye. As the examples of Figures 11, 12 and
another example: Black connects at 1, expecting 13 demonstrate, it may not be easy to come up with
White to make two eyes in the corner at `b' so Black good static rules for the third case: ensuring two
can connect at `a'. However, White can play at `a', eyes by capturing.
and it is useless for Black to `kill' the corner. If Rule 1: A player's essential block in semeai will
Black captures two stones, White recaptures and be safe after winning the semeai if there exist two
connects, leaving a 6 point nakade shape. Black opponent stones which are adjacent to both the
6
SekiScore() is close to 0, but takes into account
the number of stones in an eye that can be cap-
tured. An eye of size 2 is worth one point, an eye
of size 3 three points. For example, a seki between
a black 2 point eye and a white 3 point eye has
score 1 0 3 = 02.
The game value can now be computed as follows:
ComputeGameValue()
Figure 14: Seki(A) and seki-like nakade shape(B) f
if (isUnsettled)
f int bValue = CanWin(Black) ?
WinnerScore(Black) : SekiScore();
block and a safe block of the same player. int wValue = CanWin(White) ?
WinnerScore(White) : SekiScore();
Rule 2: A player's essential block in semeai will game = Switch(bValue, wValue);
be safe after winning the semeai if it has one eye and g
else if (winner == none)
there exists another region containing an adjacent game = IntGame(SekiScore());
opponent block which is [4] for the player.
1-vital else
game = IntGame(WinnerScore(winner));
g // ComputeGameValue
3.3 Determining the Game Value
We will use Japanese rules for counting. Chinese To get the exact combinatorial games, all scores
rules di ers mainly in case of seki. The game value must be adjusted by * if an odd number of dame
for semeai of classes 0 and 1 is simple: if the win- points remains after resolving the semeai.
ner is decided, or if it's a seki, the score is an in- One special case must be handled di erently: a
teger. If the semeai is unsettled, the score is a block with a big eye might be in atari. In this
switch. The game value can be computed using case, the player should often move immediately
two auxiliary functions returning an integer: Win- even if the semeai status is not unsettled. How-
nerScore(player) and SekiScore() . ever, if the player is losing the ght anyway, the in-
WinnerScore(player) is determined as follows: centive for moving might be only a small semedori

every shared liberty and every opponent external value, the di erence 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 modi cations
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 classi cation 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

[1] R. Hunter. Counting liberties, How to win cap-


turing races. In R. Bozulich, editor, The Second
Book of Go, chapter 7,8. Kiseido, Tokyo, 1998.
Figure 15: Double sente play in class 2 semeai [2] K.F. Lenz. Die Semeai-Formel.
, 57(4), 1982.
Zeitung
Deutsche Go-

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

[6] M. Muller. Partial order bounding: Using par-


tial order evaluation in game tree search. Tech-
nical Report TR-99-12, Electrotechnical Labo-
ratory, Tsukuba, Japan, 1999.
Figure 16: Full board semeai problems 1 and 2
The semeai evaluation method described here has
been integrated into our Go program Explorer
[3]. For testing, we constructed two full board
Go positions that contain a large variety of se-
meai positions of classes 0-2, as shown in Fig-
ure 16. Starting from these positions, we played
8

You might also like