Content uploaded by Tomoyuki Kaneko
Author content
All content in this area was uploaded by Tomoyuki Kaneko on Apr 04, 2014
Content may be subject to copyright.
Dual Lambda Search and Shogi Endgames
Shunsuke Soeda1, Tomoyuki Kaneko1, and Tetsuro Tanaka2
1Computing System Research Group,
The University of Tokyo, Tokyo, Japan
{shnsk, kaneko}@graco.c.u-tokyo.ac.jp
2Information Technology Center,
The University of Tokyo, Tokyo, Japan
ktanaka@ecc.u-tokyo.ac.jp
Abstract. We propose a new threat-base search algorithm which takes
into account threats by both players. In full-board Semeais in Go or Shogi
endgames, making naive attack moves often result in losing the game.
The reason is that a player must first make a defense move if the opponent
has a better attack move than his1own. Some attack moves weaken the
defense of the player who made the move. Thus, players must be aware of
the threats by both players to avoid such naive attack moves. However,
existing threat-based search algorithms are only aware of threats by one
player, and cannot detect such naive attacks efficiently. We propose a
solution to this problem, by applying λ-search mutually recursively so
that it searches the best move by taking into account threats by both
players. We call this search algorithm dual λ-search.Dualλ-search can
handle inversions efficiently compared to previous algorithms by making
passes for both players. We implemented dual λ-search with Df-pn as
the driver, and made experiments with difficult Shogi-endgame problems.
We showed the effectiveness of our algorithm by solving 32 problems out
of 97. It includes solving problems that even one of the strongest Shogi
program had not yet been able to solve correctly.
1 Introduction
In many games, a variety of strong game programs have been built using game-
tree search algorithms with heuristic evaluation functions. The Shogi endgame is
a particular research domain that has successfully employed this approach over
many years. However, even top-level programs still make fatal mistakes that turn
winning positions into losing ones [7]. One reason is that Shogi is a complex game.
It has huge branching factors due to the great number of legal moves, even in
endgames. Another reason is that, although threats and threat sequences play
a large role in Shogi endgames, it is difficult to construct evaluation functions
that take threats into account.
In such domains, tactical search algorithms have been effective. For example,
λ-search [14] and Generalized Threats Search [2] have solved capture games in
1For brevity, we use ‘he’ (‘his’) if ‘her or she’ (‘his or her’) is meant.
H.J. van den Herik et al. (Eds.): ACG11, LNCS 4250, pp. 126–139, 2006.
c
Springer-Verlag Berlin Heidelberg 2006
Dual Lambda Search and Shogi Endgames 127
Go, and Df-pn can solve checkmate problems in Shogi [11]. These algorithms
focus on a part of the game. Thus they are not sufficient to find a winning move
in the full game. In a Shogi endgame, a move to attack an opponent King often
threatens the King of the player who made the move. This is partly because the
player must first counter his opponent’s attack move provided that the move
could be achieved faster than his own attack move. Moreover, an attack move
itself can weaken the attacker’s King. From combinatorial game theory [4] we
know the theory on how to combine the results of searches in independent sub-
games to yield the globally best move. However, this theory does not work well
for games that cannot be divided into independent sub-games.
In order to solve this problem, we propose a new search algorithm based on
the analysis of threats by both players. Therefore, we extended λ-search to be
mutually recursive. As a consequence, our algorithm measures the threat of one
player while also taking into account the threat of the other player in the form
of inversions. By handling the attack and defense moves of one King, we can
use heuristics for searching efficiently, while still achieving the global goal by
taking into account the threats of both players. With our search algorithm, we
solved difficult Shogi problems, including some which require tricky moves that
influence threats by both players.
In Sect. 2, we give an explanation of Shogi and the Shogi endgame. In Sect. 3,
we place our work in the framework of related works. In Sect. 4, we apply λ-
search to Shogi. In Sect. 5, we propose our method, dual λ-search. In Sect. 6, we
show our experimental results, and in Sect. 7 we make some concluding remarks.
2 The Game of Shogi
Shogi is a Japanese board game played by two players. It is believed to have
the same origin as “Western” chess and Chinese chess. Compared with other
Chess-like games, Shogi has a unique “drop rule” [7]. In brief, when a piece is
captured it is not totally removed from the game, but the player who took the
piece can play it back on the board later on. This means that the number of
pieces involved in the game does not decrease towards the end of game.
Due to this rule, Shogi has a significantly complex endgame. For example,
endgame databases [13] which work well for (western) Chess are not practical in
Shogi endgames. Together with the larger search space, Shogi is considered to
be a much harder game for computers than Chess.
2.1 Checkmate in Endgame
We start defining checkmate, which plays an important role in the Shogi
endgame.
Definition 1. Checkmate (narrow sense). A position is in checkmate (nar-
row sense), if any legal move2by the player is followed by a position where the
player’s King could be captured by the opponent.
2Strictly speaking, a move that does not resolve a check is an illegal move in Shogi.
128 S. Soeda, T. Kaneko, and T. Tanaka
Definition 2. Checkmate Tree. A checkmate tree is a game tree, where one
player (the attacker) only plays check moves, and the other player (the defender)
plays all possible moves, and all leaf nodes are positions in checkmate.
Definition 3. Checkmate (wide sense). A position is said to have a check-
mate, if it is in a checkmate tree.
A search to verify if a position is in a checkmate tree is more efficient than
searching for a win in normal positions, as only check moves and moves to escape
from checks need to be considered. The introduction of Df-pn [11] has enabled
Shogi programs to solve complicated checkmate problems, and the ability of
computers to prove a checkmate has surpassed that of human grand masters.
2.2 Threats of Higher Order
Although computers are able to solve complicated checkmate problems, it is still
difficult for computers to find checkmates hidden two or three moves away from
the root position in a normal search tree. Most Shogi programs use forward
pruning based on heuristics, together with a hand-tuned evaluation function,
but it is not rare for even the top-level programs to miss the correct move which
is evident even for an intermediate human Shogi player.
Threatmate moves and brinkmates are concepts similar to check moves and
checkmate, which also play an important role in the Shogi endgame [6]. A threat-
mate move is a move by the attacker, which if neglected by the defender, allows
the attacker to establish a checkmate within next move. The defender loses un-
less either the defender can checkmate the attacker’s King, or the defender can
make a defense move that can prevent the checkmate by the attacker.
Definition 4. Threatmate move. A threatmate move is a non-check move
by a player (attacker), that is followed by a position in which, if the opponent
(defender) passes, the player (attacker) has a checkmate.
If the player has no move to resolve an checkmate by the opponent, the position
is said to be in a brinkmate.
Definition 5. Brinkmate (narrow sense). A position is in brinkmate, if any
legal move by the player (defender) is followed by a position where the opponent
(attacker) has a checkmate.
Definition 6. Brinkmate Tree. A brinkmate tree is a game tree, where one
player (the attacker) only plays check moves or threatmate moves, and the other
player (the defender) plays all possible moves, and all leaf nodes are positions in
brinkmate.
Definition 7. Brinkmate (wide sense). A position is said to have a brink-
mate, if it is in a brinkmate tree.
Although some algorithms have been proposed to search brinkmates [6,1], their
effectiveness is limited because of the large search costs caused by the difficulties
in the identification of attack and defense moves.
Dual Lambda Search and Shogi Endgames 129
3 Related Work
Game-tree search algorithms and their enhancements have been intensively stud-
ied for a long time now, including mini-max search, alpha-beta search, MTD(f),
null-move pruning, and transposition tables. Although they have made great
successes possible in many kinds of games, they do not work well in some games
with huge branching factors such as Go [10], in spite of all efforts. Our algorithm
searches more selectively by focusing on the threats, so that it can still work in
such games.
Tactical search algorithms are specialized in solving a part of the game, or a
partial goal. For example, trying to take a specific stone in the game of Go is a
partial goal. Trying to checkmate one player’s King in Chess or Shogi is another
example of a partial goal. Tactical searches are efficient because they limit their
moves related to the specific goal they handle and only search a part of the game
tree. Thus, they are still effective in games where global search does not work well.
λ-search [14], Generalized Threats Search [2], and iterative widening [3] were
applied to solve capture games or life-or-death problems in Go. Proof number
search and Df-pn were applied to solve checkmate problems in Shogi [11].
3.1 Simulation
Simulation [8] was first proposed to solve effectively Shogi positions with useless
interposing piece drops in checkmate search. It is also shown to be effective in
a solver for the game of Go [9]. The idea is as follows. Assume that position P
is proven, and position Qis a position similar to P. Then simulation borrows
moves from the proof tree of Pand tries to find a quick proof for Q.
3.2 Generalized Threats Search
Generalized Threats Search [2] is a search algorithm that could model existing
algorithms based on threat analysis. Generalized Threats Search is based on the
idea of generalized threats, which defines the depth of search and where players
could make consecutive moves. Generalized threats can represent a search tree
with a multiple level of threats at various depths. However, only passes by one
player are allowed in a given generalized threat. In contrast, dual λ-search uses
passes by both players.
An enhancement to Generalized Threats Search, called ‘forced move for left’,
is also explained in [2]. The idea is quite similar to dual λ-search in the sense that
it looks at the threats introduced not only by the attacker, but also the defender.
A similar idea was also proposed by Thomsen [14]. In dual λ-search, threats by
the defender are used to cut inversions by the defender, while in Generalized
Threats Search, it is used to cut moves by the attacker that could not block the
inversion.
3.3 Shogi Endgame
If we ignore inversions and consider only attack moves, it would be much eas-
ier to find a winning move sequences made up of threatmate moves. However,
130 S. Soeda, T. Kaneko, and T. Tanaka
Yamashita reported that it is dangerous to ignore inversions, as a check move
by the defender to the attacker’s King often prevents such naive winning se-
quences [15].
Although checkmate searchers are efficient, they are still too heavy to be called
at every leaf node of the normal search. So most Shogi programs call checkmate
searchers only at shallow depth of the search tree.
IS-Shogi, one of the strongest Shogi program, uses simulation in two ways to
to find checkmates deep in the search tree [12]. The first idea is to use simulation
to verify if a possible checkmate by the opponent was prevented properly by
IS-Shogi. In the root node, IS-Shogi first passes and sees if the opponent
has a checkmate. If so, IS-Shogi checks by simulation if the checkmate by the
opponent still holds after IS-Shogi has made a move. The second idea is to
record a successful checkmate made by IS-Shogi found in normal search, and
use this to verify if the same checkmate holds in the descendant nodes.
4λ-Search for Shogi
In this section, we start with a brief explanation of λ- search [14], then show how
it could be applied to Shogi. We call the player to move at the begin position
of the search Black, and the other player White. The aim of the search is (1) to
prove that there is a win for Black, and (2) to obtain its proof tree.
We assume that either pass is allowed, or zugzwang is not a motive. Although
this does not strictly hold in Shogi, it should cause no problem as there is
practically always a harmless move to play which could substitute a pass.
4.1 λ-Search
λ-search is an algorithm for searching a binary-valued game tree. It uses passes
together with different orders of threat sequences. A more direct threat has a
lower threat level and a more indirect threat has a higher threat level.Wedenote
with nthe level of threat. The basic idea of λ-search is to reduce the number
of positions searched, by reading along the positions where there is a threat.
Formally, λ-search could be defined by λn-trees and λn-moves.
Definition 8. λn-tree. Aλn-tree is a search tree which consists solely of λn-
moves; a λn
attack-tree is a λn-tree where Black moves first.
The value of a λn-tree is the result of evaluating the tree as an AND-OR tree.
For the leaf positions, with no λn-moves, it is disproven if it is Black to play,
anditisprovenifitisWhitetoplay.
Definition 9. λn-move. Aλn-move is a move with the following characteris-
tics. If Black is to move, it is a move that implies – if White passes – that there
exists at least one subsequent λi
attack -tree that is proven, where 0≤i≤n−1.
If White is to move, it is a move that implies that there does not exist any
subsequent λi
attack-tree that is proven, where 0≤i≤n−1.
Dual Lambda Search and Shogi Endgames 131
Fig. 1. Part of a Shogi endgame po-
sition, where Black has a λ2move
(drop Silver at 7b)
A check move is an example of a λ1-move,
as if neglected, the player who made the
check move can capture the opponent King.
Athreatmatemoveisaλ2-move. An example
of a λ2-move is shown in Fig. 1. In this posi-
tion, the first player can drop the Silver at 7b.
If the second player neglects this move and
plays elsewhere, the first player can make an-
other move to checkmate the second player.
The only move that prevents an immediate
checkmate by the second player is to move his
Silver to 7a, which would be responded by
the first player by capturing it, either with
Silver or promoted Rook. This move by the
first player is another λ2-move.
4.2 Lambda Search with One King
We introduce the notation φ, which represents a λ-search regarding only one
King. In Shogi, the game ends if either King is captured. But for the search to
determine the value of φ, we allow the search to continue beyond the capture of
the attacker’s King. When the attacker’s King is captured, we simply remove it
from the game. So, when we search for the value of φwith the goal of Black cap-
turing the white King, we allow Black to leave its King under check, and White
capturing the black King. In other words, White concentrates on defending its
own King, and forgets about attacking the black King.
For a given position P,playerpand threat level n, we define φn
p(P) as follows.
Definition 10. φn
p(P)is the value of a λ-search with the goal pcapturing the
opponent King, starting from the position P.Ifpis to play in P,φn
p(P)is
trueifthereisatleastonemovefromP, which is followed by a position which
φi
p(0 ≤i≤n)is true. If the opponent of pis to play in P,φn
p(P)is true if the
opponent of ppasses, φi
p(0 ≤i≤n−1) is true in the subsequent position, and
all move from Pis followed by a position for which φi
p(0 ≤i≤n)is true.
4.3 Lambda Search with Two Kings
Next, we represent a composite goal, in which one player can capture its oppo-
nent King without its own King being captured. This means that the player has
a successful φstarting from that position, for every position in the sequence it is
not in a successful φsequence with a lower threat level for its opponent. We in-
troduce a notation similar to the previous notation φto represent the composite
goals.
To represent that in position P,playerpcan safely capture the King of its
opponent owith a sequence made up of moves with a threat level less than n,
we use the following notation: (φn
p∧¬φn−1
o)(P).
132 S. Soeda, T. Kaneko, and T. Tanaka
Definition 11. (φn
p∧¬φn−1
o)(P)is the value of a λ-searchwiththegoalpcap-
turing the opponent King, without its own King being captured, starting from
the position P.Ifpis to play in P,(φn
p∧¬φn−1
o)(P)is true if there is at least
one move from P, which is followed by a position which (φi
p∧¬φj
o)(P)(0 ≤i≤
n, 0≤j≤i−1) is true. If the opponent of pis to play in P,(φn
p∧¬φn−1
o)(P)
is true if the opponent of ppasses, (φi
p∧¬φj
o)(P)(0 ≤i≤n−1,0≤j≤i−1) is
true in the subsequent position, and all moves from Pare followed by a position
for which (φi
p∧¬φj
o)(P)(0 ≤i≤n, 0≤j≤i−1) is true.
Note that this composite goal is not the same as the conjunction of simple goals
φn
p(P)∧¬φn−1
o(P), as the latter notation allows the move to support φn
p(P)and
the move to support ¬φn
o(P) to be different. For example, take a position P,in
which pis to play and which has two children, Qand R(Fig. 2). Let Qand R
have the following values (see table in Fig. 2).
P Q R
φ0
pfalse false false
φ0
ofalse true false
φ1
ptrue true false
φ1
otrue true true
φ1
p(X)∧¬φ0
o(X)true false false
(φ1
p∧¬φ0
o)(X)false false false
Fig. 2. A position P,pto move, with two child nodes Qand R
From φ0
p(Q)=falseandφ0
p(R) = false follows φ1
p(P)=false.Thecompos-
ite goal (φ1
p∧¬φ0
o)(P)isfalse,asneitherQnor Rcan support it. However,
φ1
p(P)∧¬φ0
o(P)istrue,asφ1
p(Q) supports φ1
p(P)and¬φ0
o(R) supports ¬φ0
o(P).
Moreover, the result by the non-composite goal is incorrect, for this position is
aoto win position, with φ1
o=trueandφ0
p= false for both moves.
5DualLambdaSearch
In this section, we show how to expand λ- search [14] into dual λ-search. λ-search
is a rather efficient way of searching when threats and threat breaking moves are
important. However, λ-search with a single goal can only be applied to search
in local games, and does not always yield correct results for global searches of
the game. λ-search with a composite goal could handle global games properly,
but lacks the efficiency of the original λ-search, as passes of only one player are
concerned. Below, we propose the dual λ-search algorithm where threats of both
players are taken both into account.
Dual Lambda Search and Shogi Endgames 133
5.1 Formalization
We formalize dual λ-search with μn
j-moves and μn
j-trees, where pdenotes a player
and ndenotes the threat level of the search. We denote by othe opponent of
player p.
Definition 12. μn-tree. Aμn
p-tree is a search tree which consists solely of μn
p-
moves.
Definition 13. μn-move. Aμn
p-move is a move with the following character-
istics.
If pis to move, it is a move that implies it is followed by a position where, if o
passes, there exists at least one subsequent μi
p-tree that is proven, and there does
not exist any subsequent μi
o-tree that is proven, where 0≤i≤n−1.
If ois to move, it is a move that implies that there does not exist any subsequent
μi
p-tree that is proven, where 0≤i≤n−1.
Fig. 3. Part of a Shogi endgame po-
sition. If the first player uses Sil-
ver to attack, the second player
can move the promoted Rook to 6i,
which the first player cannot de-
fend.
Unlike previous algorithms, where attack by
only one player is concerned, our algorithm
takes account of the threats by both players.
This could be well illustrated by the example
shown in Fig. 3. This position is almost iden-
tical with Fig. 1, except that the black King
and the surrounding pieces have been added.
In this position, Black dropping Silver to
7b is a naive attack move, and if played
back by White moving promoted Rook to 6i.
TheonlymovebyBlacktoavoidimmediate
checkmate is to move Silver to 7i. However,
White can still checkmate Black by capturing
the Silver with moving promoted Rook to 7i.
Moreover, not making any attack move is bet-
ter than dropping Silver to 7b, as even when
Black passes, there is no immediate check-
mate of the black King by White. This is an
example where a λ-search with a single goal
fails to yield a correct result.
This problem could be also handled by λ-
search with composite goals, but it lacks effi-
ciency. After Black chose to drop a Silver at
7b, the question is: which move should White make? This is a easy question
for dual λ-search, as 6a promoted Rook is a μ1
Wmove, and should be tried to
see if this position is a win for White, before μ2
Bmoves should be considered.
However, as λ-search with composite goals does not consider threats by White,
it thus cannot limit candidates to be searched first.
134 S. Soeda, T. Kaneko, and T. Tanaka
5.2 Dual Lambda Search with Df-pn
Df-pn is an algorithm for searching AND-OR trees, that searches the thinner
part of the search tree first [11]. For AND-nodes (attacker’s positions), it starts
searching from the node with the least number of leaves required to be expanded
to prove the node. For OR-nodes (defender’s positions), it starts searching from
the node with the least number of leaves required to be expanded to disprove the
node. Df-pn is efficient in searching non-uniform trees, and is the best known
algorithm to solve Shogi checkmate problems. Below, we show how Df-pn could
be used as the driver for dual λ-search.
We denote the player to move at the initial position as p, and his opponent
o. We start from a lower threat level, and for each level we start from trying to
prove a win for p. That is, we start from λ0
p,thengoontoλ0
o,λ1
p,λ1
o,λ2
p... until
a win is proven for one player.
For each position in the search, we do a similar iteration. If we are searching
to prove λn
p,westartfromprovingλ0
p,uptoλn
p. The position is proven if λi
p
is proven and λi−1
ois disproven for i(i≤n). The position is disproven if λi
pis
disproven for all i(0 ≤i≤n)orλi−1
ois proven.
The proof number and disproof number of each position is defined for each
threat level and player. For position P,λi
p.p(P) denotes the proof number for
player pat threat level i,andλi
p.d(P) denotes the disproof number for player p
at threat level i.
If Pis a position without any moves to play, it is a terminal position. If pis
to play in P,λi
p.p(P)=∞and λi
p.d(P)=0.Ifois to play in P,λi
p.p(P)=0
and λi
p.d(P)=∞.
If Pis a position with moves to play, it is an internal position. The proof num-
ber and disproof number are calculated from the children of P.Ifthethreatlevel
is lower than 0, both the proof number and the disproof number of the position
is 0. The proof number and disproof number of an unexpanded position is 1.
If pis to play in P,
λi
p.p(P)= min
s∈childs(P)(λi
p.p(s)+λi−1
o.d(s))
λi
p.d(P)=min(
s∈childs(P)
(λi
p.d(s)),
s∈childs(P)
(λi−1
o.p(s))) .
Let tdenote the position after a pass from P.Ifois to play in P,
λi
p.p(P)=λi−1
p.p(t)+
s∈childs(P)
(λi
p.p(s)) +
s∈childs(P)
(λi−1
o.d(s))
λi
p.d(P)=min(λi−1
p.d(t),min
s∈childs(P)(λi
p.d(s)),min
s∈childs(P)(λi−1
o.p(s))) .
Positions are expanded until there are no more positions to expand. The
position to be expanded is chosen as follows. For a position pto play, the child
position with the least proof number is chosen, and for a position oto play, the
child position with the least disproof number is chosen, until an unexpanded
position is found.
Dual Lambda Search and Shogi Endgames 135
6 Experimental Results
To show the effectiveness of our algorithm, we solved some Shogi endgame posi-
tions with our search algorithm. In our experiments, we used full-board endgame
positions where the first player can find a win by brinkmate if he played properly.
We chose the problems from a test set provided by Grimbergen [5]. None of the
problems in the test set was solved by the top Shogi programs on the market at
the time when [5] was written. Thus, the test set represents the weakness of the
current Shogi programs. The test set had 97 problems with endgame positions,
none of them with an immediate checkmate.
6.1 Move Generator
We heuristically limited our move generation. In general, if we generate more
moves, we obtain more accurate results under the sacrifice of the search space
and the speed. However additional moves sometimes do reduce the search cost
by rejecting naive attacks and defenses. So what we want is the smallest set of
moves that contains “the right” moves. To decide what moves to generate, we
started with the minimal set of moves and gradually added moves that were
needed to solve some problems.
For the attack moves, we decided to generate three categories of moves: (1)
moves that the pieces to be moved could move into the 25 squares surrounding
the defender’s King on its next move, (2) moves to open way for the big pieces,
and (3) moves that captures any opponent piece.
For the defense moves, we came up with six categories of moves: (1) moves
that moves the King, (2) moves that capture the piece that has been just played
by the attacker, (3) moves that increases the liberty of the King by moving a
piece occupying a square where the King can move, (4) drop moves to the 8
squares surrounding the King, (5) moves that capture the attacker’s pieces that
could move into the 8 squares surrounding the King on its next move, and (6)
moves of the piece to be moved that can move into the 8 squares surrounding
the King on its next move.
Note that whenever the player to move is under check, instead of generating
the moves introduced above, all check escaping moves are generated.
6.2 Solving Shogi-Endgame Problems
Dual λ-search depends on other search techniques for searching the μ-trees. In
our preliminary experiments, dual λ-search driven by iterative-deepening depth-
first search was only able to solve quite simple problems. So we chose Df-pn as
the driver for the dual λ-search in our experiments.
Implementing Dual λ-Search. We have incorporated an enhancement pro-
posed by Kishimoto to handle loops efficiently with Df-pn [9]. However, we have
not incorporated enhancements to handle GHI problems correctly. We used an
estimator for the proof numbers and disproof numbers of the pre-expanded po-
sitions, based on the liberty of the defender’s King.
136 S. Soeda, T. Kaneko, and T. Tanaka
We implemented both λ-search and dual λ-search with Df-pn as its driver.
We used a dual Opteron 250 PC, with 12GB of memory. We did not give a
explicit time limit or table size limit to the program, so the program stopped
either when it found a winning move or when it exhausted the memory.
Tabl e 1. Comparison with λ-search
Correct Unknown Incorrect
dual λ-search 32 63 2
λ-search 20 46 31
Comparison with λ-Search
with One King. The results
of the comparison with λ-search
are shown in Table 1. If the
program gave the correct first
move, we counted it as “cor-
rect”, and if it gave a wrong
move, we counted it as “incor-
rect”. For most problems, the program ran out of memory which we counted
“unknown”. Dual λ-search gave only 2 incorrect answers, while λ-search with
one King gave as much as 31 incorrect answers. This shows the importance of
taking into account the threats by both players.
Dual λ-search was able to give a correct solution of some problems that even
could not be correctly answered by the development version of the strongest
Shogi program YSS.3
Comparison with General Search. We had our Shogi playing program GPS-
Shogi solve some of the problems, to compare dual λ-search with a general Shogi
playing program.
GPS-Shogi searches with MTD(f) for normal positions, and with Df-pn for
a checkmate position. We had GPS-Shogi solve the problems for which dual
λ-search was able to give the correct answers. Let us see how many nodes GPS-
Shogi required to explore, to find the correct answer. We started with a small
search limit, and increased the limit until either GPS-Shogi was able to find
the correct move, or the limit was surpassing a large threshold.
For most problems, GPS-Shogi was not able to find the correct move al-
though the program searched considerably more nodes compared to dual λ-
search. This clearly shows the strength of dual λ-search in the Shogi endgame.
Incorrect Answers. As we limited the defense moves, our solver gave incorrect
answers for two problems. The problems were 44 and 85.
Problem 44 is shown in Fig. 5. The correct sequence for this problem starts
with 2a Gold. However, our program gives 2a Bishop (promote) as the answer.
The sequence goes on 2a King (capture Promote Bishop) by the defender, 4b
Rook (promote) by the attacker. The best move for the defender is 7i Bishop
(drop) which is a check to the attacker’s King. Although this move does not
establish a checkmate, it is a brinkmate-breaking brinkmate move, which brings
a win to the second player.
Problem 85 is shown in Fig. 6. The correct sequence for this problem starts
with 2c Silver, but our program generates 2c Gold. The reason for this is that the
3A message from the Computer Shogi Association mailing list.
Dual Lambda Search and Shogi Endgames 137
Tabl e 2. Search space and search time of dual λ-search for the problems solved
Problem Tabl e Positions Problem Ta b l e Positions
ID size explored ID size explored
15,077,274 13,625,141 40 2,687,773 5,341,140
323,127,440 51,547,045 47 6,322,382 16,688,986
53,324,052 9,071,688 53 653,649 1,694,982
612,693,730 28,224,664 55 985,227 2,333,563
13 332,886 927,355 56 41,194 119,889
14 2,779,596 7,424,350 67 1,777,506 4,121,735
18 819,600 1,837,131 69 128,301 283,346
19 3,096,938 7,930,800 70 410,784 1,176,575
25 21,068 66,176 74 2,552,585 4,914,454
28 9,847,634 26,819,205 76 158,928 325,432
29 9,544,140 22,514,140 79 1,561,958 2,538,576
31 2,789,624 7,958,037 80 2,958,425 6,172,481
32 4,035,965 10,369,349 81 3,359,032 8,814,780
34 5,256,028 14,586,670 89 10,327,673 15,145,559
36 3,386,594 8,628,844 94 1,019,703 2,586,687
38 14,709,681 35,263,407 99 13,041,836 32,832,194
10000
100000
1e+06
1e+07
1e+08
10000 100000 1e+06 1e+07 1e+08
MTDF
dual lambda search
MTDF correct
MTDF incorrect
y=x
Fig. 4. Comparison of dual λ-search and GPS-Shogi search
program does not generate the next move 3e Promoted Bishop by the defender
with the current sets of move generating rules.
Both problems could be solved by generating more moves for the defender.
Problem 85 could be solved by adding more defense moves, such as 3e Pro-
moted Bishop. However, when we generate more defense moves, we had to give
away many correct answers. That is why we are reluctant in adding the moves.
Problem 44 could be also solved if more defense moves were generated. If check
moves by the defender were generated, problem 44 could be answered correctly,
but some other problems would then not be solved.
138 S. Soeda, T. Kaneko, and T. Tanaka
Fig. 5. Problem 44 Fig. 6. Problem 85
7Conclusion
We proposed a new search algorithm called dual λ-search. It is based on a search
algorithm called λ-search. Although λ-search is an efficient algorithm, it is only
aware of attacks by one player. Dual λ-search takes into account of attacks by
both players and could be used for searching for the whole game, while the
original λ-search could only be used in searches for a part of a game.
The new algorithm is quite effective in the endgame positions of many games,
including Shogi. Shogi is a Japanese board game played by two players, which
has a the unique “drop rule”. For this rule, Shogi has a significantly complex
endgame, and together with the larger search space, Shogi is considered to be a
much harder game for computers than Chess.
We have conducted some experiments to show the strength of this algorithm,
by solving some positions taken from a test set of complicated Shogi problems.
We were able to solve complex problems with our search algorithm, some were
solved for the first time by a computer program. We compared our algorithm
with λ-search as well as with a general Shogi-playing program. We have achieved
both high level of accuracy as well as competitive speed.
Based on these results, we may conclude that our algorithm has been success-
ful in the Shogi endgame, and is expected to be also useful in other games that
require a global search, provided that it is possible to decompose the game into
reasonably independent sub-games.
References
1. M. Arioka. Search in Shogi program KFEnd. In Advances in Computer Shogi 4,
pages 18–40. Kyoritsu, 2003.
2. T. Cazenave. A Generalized Threats Search Algorithm. In 3rd Computers and
Games Conference (CG 2002), (eds. J. Schaeffer, M. M¨uller, and Y. Bj¨ornsson),
LNCS 2883, pages 75–87, Springer-Verlag, Berlin, 2003.
Dual Lambda Search and Shogi Endgames 139
3. T. Cazenave. Iterative Widening. In IJCAI-01 Proceedings, volume 1, pages 523–
528, 2001.
4. J.H. Conway. On Numbers and Games. Academic Press, 1976.
5. R. Grimbergen and T. Muraoka. What Shogi Programs Still Cannot Do - a New
Test Set For Shogi. In The 9th Game Programming Workshop in Japan, pages
40–47, 2004.
6. H. Iida and F. Abe. Brinkmate Search. In Game Programming Workshop in Japan
’96, pages 160–169, Kanagawa, Japan, 1996.
7. H. Iida, M. Sakuta, and J. Rollason. Computer Shogi. Artificial Intelligence,
134(1-2):121–144, 2002.
8. Y. Kawano. Using Similar Positions to Search Game Trees. In Games of No
Chance, pages 193–202. Cambridge University Press, 1996.
9. A. Kishimoto and M. M¨uller. DF-PN in Go: An Application to the One-Eye
Problem. In 10th Advances in Computer Games (ACG10), Many Games, Many
Challenges (eds. H.J. van den Herik, H. Iida, and E.A. Heinz), pages 125–141,
Kluwer Academic Publishers, Boston, 2004.
10. M. M¨uller. Computer Go. Artificial Intelligence, 134(1-2):145–179, 2002.
11. A. Nagai and H. Imai. Application of DF-PN Algorithm to a Program to Solve
Tsume-Shogi Problems. In IPSJ Journal, 43:1769–1777, 2002.
12. Y. Tanase. Algorithm of IS Shogi, pages 1–14. Kyouristu, 2000. (in Japanese).
13. K. Thompson. Retrograde Analysis of Certain Endgames. ICCA Journal, 9(3):131–
139, 1986.
14. Th. Thomsen. Lambda-Search in Game Trees — With Application to Go. In
2nd Computer and Games Conference (CG 2001) (eds. T. Marsland and I. Frank),
LNCS 2063, pages 19–38, Springer-Verlag, Berlin, 2001.
15. H. Yamashita. YSS - Data Structure and Algorithm. In Advances in Computer
Shogi 2, pages 112–142. Kyoritsu, 1998. (in Japanese).