PSPACE-hardness of Checkers and Draughts - liacs

PSPACE-hardness of Checkers and Draughts
J.N. van Rijn
Leiden Institute of Advanced Computer Science
Universiteit Leiden
[email protected]
June 7, 2011
Abstract
In this report we will give a formal definition of the (generalized)
games Checkers and Draughts, and we will report on the proof that
Checkers is PSPACE-hard from “The complexity of checkers on an
N ∗ N board”, by Fraenkel et al. (1978). We will use a similar proof
to show that Draughts is also PSPACE-hard. Note that later research
has shown that Checkers is actually EXPTIME-complete.
1
Introduction
Checkers and Draughts are abstract strategy board games between two players which involve diagonal moves of uniform pieces and mandatory captures
by jumping over the enemy’s pieces [9]. In Figure 1 the initial configuration
of a Checkers game is shown.
Checkers is very popular in the United States and the United Kingdom,
which could be the reason that a lot of research has been done towards
this game, unlike Draughts. In [1] it is proven that Checkers is PSPACEhard. This result has been strengthened in [2], which showed Checkers to
be EXPTIME-complete. Another impressive contribution has recently been
done in [3], which showed that optimal play of both players will result into
a draw.
In Section 2 a formal definition of both Checkers and Draughts is presented. In Section 3 we will report on the proof constructed by [1] that
1
Figure 1: Initial board configuration of Checkers, taken from [8].
Checkers is PSPACE-hard, and present a similar proof for Draughts. In Section 4 a conclusion is drawn and some suggestions for future research are
mentioned.
2
Problem Definition
In this section we will give a formal definition of both Checkers and Draughts.
Since Draughts is very similar to Checkers, some parts of this definition
depend on the definition of Checkers.
2.1
Checkers
Checkers is played on an 8 × 8 board consisting of dark and light squares,
where each dark square is horizontally and vertically adjacent to only light
squares and each light square is horizontally and vertically adjacent to only
dark squares. Only the dark squares will be used during the game. The game
is played by two players, who both occupy an opposing side of the board and
each have the possession of 12 pieces. One player uses dark pieces (mostly
black), the other player uses white pieces. Initially these pieces are positioned
in such a way that on both sides of the board all dark squares on the first
three rows are occupied by a piece of the player occupying that side. In
Figure 1 the initial position of Checkers is shown. All these pieces are called
2
men, later in this section we will introduce another type of pieces, i.e., kings.
Checkers can be generalized to an n × n board. Whether the initial configuration consists of 3 or n/2 − 1 occupied rows for both players, which
both generalize the original version, does not matter for our purposes. The
columns and rows on the board are numbered from 1 to n. Square (i, j) with
i, j ∈ {1, . . . , n} is defined to be the square in the i-th column and the j-th
row.
Starting with black, players take turns making a move, which is defined
to be the translocation of some piece on square (i, j) to a vacant square
which is diagonally adjacent to the square occupied by the moving piece,
moving forward (as seen from the player). For black, all squares diagonally
adjacent to square (i, j) are {(i − 1, j − 1), (i + 1, j − 1)}; for white these
are {(i − 1, j + 1), (i + 1, j + 1)}. To generalize this, we define the diagonally
adjacent squares for square (i, j) to be {(i + a, j + b)}, where a ∈ {−1, 1}
and b = −1 for the black player; b = 1 for the white player. Of course, these
squares have to be on the game board.
Another type of move is the capture, which can be done when a square
diagonally adjacent to one of the player’s pieces is occupied by a piece of
the other player and the square diagonally adjacent in the same direction
to that square is vacant. In that case the player can move his piece to the
vacant square and remove the opposing piece that was in between. Formally,
when square (i, j) is occupied by a piece of the player who is on turn, square
(i + a, j + b) is occupied by an opposing piece and square (i + 2 ∗ a, j + 2 ∗ b)
is vacant, the player can make a capture. If the piece ends on a square from
where another capture can be done, the player must also make this capture,
repeatedly, until the piece is on a square from where no captures are possible.
It is very important to mention that when both captures and normal moves
are possible, the player is obligated to make a capture.
When a piece reaches the last row of the board (which is row 1 for the
black player, row n for the white player), the piece is promoted to a king.
When a piece is a king, the player can move it and make captures in any
direction. Formally, when a king is on square (i, j), he can move to squares
(i + a, j + c) where a, c ∈ {−1, 1}. When square (i + a, j + c) is occupied by an
opposing piece and square (i + 2 ∗ a, j + 2 ∗ c) is vacant, the king can make a
capture. For the king it also holds that if it ends on a square where he can do
another capture, the player is obligated to continue making captures, until
the king ends on a square from where no captures can be done.
The game is won when the opposing player is unable to make a move.
3
This can be because all his pieces are captured, or because all his pieces are
closed in, in such a way that both captures and normal moves are impossible.
2.2
Draughts
Draughts is in many ways similar to Checkers, although the pieces tend to be
slightly more aggressive. Though we will also generalize Draughts to an n × n
board, it might be interesting to mention that normal Draughts is played on
a 10 × 10 board. The initial position of a Draughts game is of the same kind
as the initial position of a Checkers game; on each side the first four rows are
occupied by pieces.
Players take turns making a move, starting with white. A player can move
his men in the same way as in Checkers. When making a capture, the player
is not restricted in the direction he wants to do this. When having a piece at
square (i, j), such that a square (i + a, j + c) with a, c ∈ {−1, 1} is occupied
by an opposing piece and (i + 2 ∗ a, j + 2 ∗ c) is vacant, the player can move
his man to the vacant position, and remove the opposing piece in between.
In Draughts the kings have an interesting property which gives them the
ability to move in one turn over a large number of squares. Formally, a king’s
move is defined to be the translocation of the king from position (i, j) to
position (i + s ∗ a, j + s ∗ c) where s is in {1, . . . , n}. A king can only make
this move if none of the squares in the range of {(i + 1 ∗ a, j + 1 ∗ c), . . . , (i +
s ∗ a, j + s ∗ c)} is occupied by any piece. If there is exactly one opposing piece
in this range, the player can make a capture. If the king ends on a square
from where another capture can be made the player is obligated to also make
this capture, unless this would take the king in the exact opposite direction
of the previous capture. In that case the capture may not be done.
When when both captures and normal moves are possible, the player
must necessarily make a capture, as in Checkers. When multiple capture
sequences are available, the player is obligated to choose such a sequence,
that the number of captured pieces is maximised. There are also some other
subtle differences compared to checkers.
As in Checkers, the game is won when the opposing player is unable to
make a move.
4
3
PSPACE-hardness
In [1] it is shown that Checkers is PSPACE-hard. This is done by a reduction
from Bipartite Planar Geography, from here on abbreviated as BPG.
BPG is played on a bipartite directed graph G = (V1 ∪ V2 , E) where all
edges in E either go from a vertex in V1 to a vertex in V2 or vice versa. The
first player removes an edge from V1 to V2 which is defined to be the edge
that starts the game. After that, starting with player 2, the players alternate
removing edges from G. Each turn, an edge must be removed which is leaving
from the vertex to which the previously removed edge was ending. Note that
because G is bipartite, player 1 can only remove edges leaving from V1 and
player 2 can only remove edges leaving from V2 . The first player unable to
make a move has lost the game. We consider a restricted version of BPG
where the only allowed (in-degree, out-degree) combinations are (1,0), (1,1),
(1,2) and (2,1). There also is a single (0,1) vertex, which is in V1 . The edge
connected to this vertex is the edge which is played in the first move. This
restricted version is introduced in [5] and proven to be PSPACE-complete
in [6].
3.1
Simulating BPG
We present the construction from [1], where it is shown how BPG can be
simulated by a Checkers game in such a way that there exists a winning
strategy for a player for Checkers by optimal play if and only if there exists a
winning strategy for the same player on BPG by optimal play. The simulation
will highly depend on the property of Checkers that a move involving a
capture must always be chosen over a move which does not involve a capture.
The simulation will be set up in such a way that the first player who is not
obligated to make a capture will win the game.
In order to simulate an instance of BPG using a game of Checkers, we
first need to find a way to embed the graph G in such a way that all edges are
made up of horizontal, vertical and 45◦ diagonal line segments connecting the
vertices. No two edges may intersect, except at a shared vertex. This can be
done in polynomial time using a polynomial bounded region of the checkerboard, given the output of a standard polynomial time planarity algorithm
such as the one in [7].
All edges can be represented on the checkerboard by a jumpable path, that
is a group of pieces lined up in such a way that a single opposing king could
5
Figure 2: A jumpable path consisting of black pieces. The dotted line shows
in which way a single white king could capture all the black pieces in one
turn. Taken from [1].
capture all these pieces in one turn if it were at the proper starting position.
Figure 2 shows how to construct a jumpable path. We would like to stress the
fact that all pieces used in the simulation are kings. In Figure 3 it is shown
how to simulate the required vertices on the checkerboard. All vertices shown
are in V1 . In order to construct vertices from V2 , all white pieces should be
replaced by black pieces and all black pieces should be replaced by white
pieces. The correctness of these vertices can easily be confirmed, as we will
do next.
In Figure 3(a) a vertex with a (in-degree, out-degree) of (1,2) is shown.
When in BPG a player (say player 2, being white in Figure 3(a)) removes
an edge which is ingoing to a vertex such as shown in this figure, the other
player has to remove one of the two outgoing edges from this vertex. After
player 2 has finished his sequence of captures, his piece is positioned in such
a way that player 1 has to do a move which involves the capturing of this
piece. Player 1 has the choice of removing the left edge or the right edge. As
in BPG returning to this vertex is impossible, since the only ingoing edge is
removed by player 2. The remaining edge will stay on the board, until the
simulation of BPG has ended.
Quite similar to this vertex is the vertex shown in Figure 3(b). After
player 2 finished his sequence of captures player 1 is forced to start a sequence of captures starting with the piece that player 2 ended his turn with.
Returning to this vertex is, like in BPG, impossible.
In Figure 3(c) a vertex with an (in-degree, out-degree) of (2,1) is shown.
6
(a) (1,2) vertex
(b) (1,1) vertex
(c) (2,1) vertex
(d) (1,0) vertex
Figure 3: Simulation of (in-degree, out-degree) vertices in V1 , taken from [1].
The black line shows jumpable paths for black kings; the dotted line shows
jumpable paths for white kings.
7
Figure 4: Initialization of the simulation, taken from [1].
There are two edges which can be removed by player 2 that both force player 1
to remove the outgoing edge. In BPG, if after that sequence of moves player 2
manages to remove the other ingoing edge, player 1 is unable to move and
loses the game. In Checkers, player 1 can still make a sequence of three
captures, i.e., the piece with which player 2 finished his sequence of captures
and the two pieces which are residual from the previous move. However, after
player 1 finishes this sequence of captures, player 2 is no longer forced to make
a capture which, as we will see later, gives player 2 a straightforward way of
winning the game.
Figure 3(d) is quite similar to this. Player 2 chooses an edge which is
ingoing to a vertex without any outgoing edges. In BPG, since player 1 is
unable to remove another edge, he immediately loses the game. In Checkers,
he is forced to make a capture with which he does not force player 2 to make
a capture in return. This again will result in a straightforward way of winning
the game for player 2.
The simulation is started by player 1, who is forced to remove the edge
that is by rule the edge that should be removed in the first turn of BPG. It
can easily be verified that during the simulation of BPG both players can
only remove edges in the proper direction.
3.2
Winning strategy
In this section we will point out how the first player who can do a move that
does not involve a capture has a winning strategy by optimal play. For this,
we first need to define the concept of what is called by the authors of [1]
8
Figure 5: Schematic diagram of an n phalanx.
a phalanx. A phalanx is a formation in ancient Greek warfare, in which the
infantry is lined up in such a way that they can march forward as one entity,
crushing the opponent [10]. In our global construction we will use phalanxes
similar to this. A schematic view of how to construct such a phalanx is shown
in Figure 5. It has a thickness of 4n rows (of kings), and is called an n phalanx.
When having at most n opposing pieces within the phalanx, the besieging
player can always close in or capture all opposing pieces within the phalanx.
An interesting property of Checkers is that the number of pieces is not
all decisive. A player can have a million-to-one advantage in pieces, and still
lose the next turn if lined up correctly. In the construction we will make use
of this property in such a way that white has an advantage in number of
pieces, but is lined up in such a way that this does not necessarily lead to a
win. The global construction, as shown in Figure 8 later on, involves a black
phalanx around the region where BPG is simulated. A line of white kings
extends from here and is wrapped around this phalanx many times, in such
a way that given enough time to regroup, white can construct an n phalanx
with n being the number of all black pieces on the board. This line of white
kings is referred to as the white army. The white army is also lined up in
such a way that a single black king could capture all pieces of the white army
in a single move. In fact, the spiral of the white army is one long jumpable
path. The king that can capture all these pieces will be referred to as the
dangerous king.
9
(a) Dangerous king launcher.
(b) White’s ambush for the dangerous king.
Figure 6: Decisive moves for both the black and white player.
Figure 6 shows in what way a player can gain a decisive advantage when
he is the first who is not obligated to make a capture. If this is the black
player, he should move the piece that is denoted by A in Figure 6(a) into the
direction of the arrow. White is now obligated to capture this piece, which
lines up his piece in front of the dangerous king, denoted by D. This will
guarantee that the dangerous king will capture all pieces of the white army
in the next turn, which means that the only remaining pieces of white are
inside the black phalanx. This eventually means a victory for the black player.
When the white player on the other hand is the first player who has a free
move, he can set up an ambush for the black king, as shown in Figure 6(b).
When white moves the piece denoted by B into the direction of the arrow,
the dangerous king will only be able to capture a small fraction of the white
army and this gives white the possibility to regroup the pieces from the white
army into an n phalanx, where n is the number of black pieces on the board.
All black pieces will be within this phalanx, which eventually means a victory
for the white player.
Since the white army is spaced out in such a way that it will take a large
number of moves to form the phalanx, there is absolutely no guarantee that
black will not be able to interfere with this process. A more subtle way of
preventing black from doing so is now necessary. The authors of [1] came up
with the notion of picket lines, which will solve this problem. The spiral of
white pieces which is wrapped around the black phalanx n additional times,
with the aim of forming these into picket lines. Figure 7 shows how this can
10
Figure 7: White can form n picket lines in 2n moves.
be done. Black has to sacrifice at least one of its pieces to break a picket
line, so when having n picket lines with n being the total number of black
pieces, for black it is impossible to get a single piece outside the picket lines.
This ensures that white has enough time to form his phalanx outside the
picket lines, and eventually use this to close in all black pieces. The overall
construction is shown in Figure 8.
If there exists a polynomial time solution to Checkers, so there is one for
BPG. Hence BPG can not be harder than Checkers. Since BPG is PSPACEcomplete, we can conclude that Checkers is PSPACE-hard.
3.3
Draughts
After showing the proof that Checkers is PSPACE-hard, an obvious question
would be whether this also holds for Draughts. As seen in Section 2 both
games are quite similar. In order to simulate BPG some slight changes are
necessary. Since a Draughts king can capture pieces over a wide range, it is
easier using only men. During a capture, a Draughts man can do anything
a Checkers king can. Another difference between Checkers and Draughts is
the fact that in Draughts the player is obligated to capture pieces in such a
way, that at the end of the sequence the largest possible number of pieces is
captured.
This has consequences for the (1,2) vertex shown in Figure 3(a). The
outgoing jumpable paths should both be of the same size, otherwise according
to the Draughts rules the player is obligated to choose the longest path. This
11
Figure 8: Global view of the construction, taken from [1].
choice can be preserved by converting the (1,2) vertex in five parts: the
initial part which is shown in Figure 3(a), with both outgoing edges a small
jumpable path of the same size, and after that on both sides two concatenated
(1,1) vertices, where the sizes of these jumpable paths do not matter. We need
two of these vertices on both sides, in order to make sure that both players
can only remove edges from the same set as they did before.
Using only man pieces does not influence black’s dangerous king launcher,
white’s ambush for the dangerous king and the formation of picket lines.
When the simulation of BPG turns out in the advantage of black, he will
also have a straightforward way of winning the game. Since all white pieces
are inside the phalanx and the white pieces can only move to one side of the
board, black does not need to put effort into closing in the white pieces. The
white player will be forced to eventually move them towards the black man
forming the phalanx and lose, due to his disadvantage in numbers.
When the simulation of BPG turns out in the advantage of white however,
the only thing he has to do is setting up the picket lines. Unlike Checkers,
the black player can now only move in one direction which will eventually
lead to a collision with the picket lines. By optimal play, black can destroy
all pieces in an entire picket line after sacrificing a single piece. Since there
are as many picket lines as black pieces, this eventually will lead to a victory
for white. Note that in the meantime white has to make moves that do not
disassemble the picket lines. White has the ability to move a non significant
12
piece outside the picket lines towards the last line, promote it to a king, and
move it forward and backward as many times as necessary.
From this we conclude that Draughts is also PSPACE-hard.
4
Conclusion and Future Work
We have given a formal definition of both Checkers and Draughts, and
reported on the work of [1] showing that Checkers is PSPACE-hard. We
used this proof to construct a similar proof showing that Draughts is also
PSPACE-hard.
The authors of [2] already showed that Checkers is actually EXPTIMEcomplete by a reduction from G3 [4], which is a strengthening of the result
provided in [1]. Since Draughts and Checkers are very similar we conjecture
that Draughts is also EXPTIME-complete, however no research towards this
topic has been done. It would be an interesting result if someone were to
prove Draughts also EXPTIME-complete.
References
[1] A. S. Fraenkel, M. R. Garey, D. S. Johnson, T. Schaefer, and Y. Yesha,
The complexity of checkers on an N ∗ N board, preliminary report,
Proc. 19th IEEE Symp. Found. Comp. Sci. (1978) 55–64
[2] J. M. Robson, N by N checkers is Exptime complete, SIAM Journal
on Computing, 13(2):252–267, 1984
[3] J. Schaeffer, N. Burch, Y. Björnsson, A. Kishimoto, M. Müller, R. Lake,
P. Lu and S. Sutphen, Checkers Is Solved, Science Vol. 317 no. 5844
(2007), pp. 1518–1522
[4] L. J. Stockmeyer and A. K. Chandra, Provably difficult combinatorial
games, SIAM Journal on Computing, 8 (1979), pp. 151–174
[5] T. G. Schaefer, Complexity of some perfect-information games, J. Comput. System Sci., 16 (1978), 185–225
[6] D. Lichtenstein and M. Sipser, GO is Polynomial-space Hard, J. Assoc.
Comput. Mach. 27 (1980), 393–401
13
[7] E. Hopcroft and R. E. Tarjan, Efficient planarity testing, J. Assoc.
Comput. Mach. 21 (1974), 549–568
[8] The Wikimedia Foundation, English draughts, http://en.wikipedia.
org/wiki/English_draughts [retrieved April 28, 2011]
[9] The Wikimedia Foundation, Draughts, http://en.wikipedia.org/
wiki/Draughts [retrieved May 14, 2011]
[10] The
Wikimedia
Foundation,
Phalanx
formation,
http:
//en.wikipedia.org/wiki/Phalanx_formation [retrieved May
13, 2011]
14