Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

Invented in 2010 by Corey Clark, Slither is relatively new connection game with an increasing popularity among online board game players. Unlike hex and havannah which are played on a hexagonally-paved board, Slither is played on a grid and each player is trying to connect a pair of opposite edges corresponding to their color by constructing connected groups of stones. Whereas moves in most other connection games only involve putting down a new element on the board, moves in Slither also allow relocating previously played stones. A second important difference between usual connections games and Slither is that some stone configurations are forbidden in Slither. Namely, a player is not allowed to play a stone diagonally adjacent to a pre-existing stone of their color unless one of their already placed stones would be mutually adjacent.

The goal of this paper is to study the properties of Slither in order to understand better the impact of features such as forbidden configurations and stone relocation on a connection game.

Since its independent inventions in 1942 and 1948 by the Danish poet and mathematician Piet Hein and the American economist and mathematician John Nash, the game of Hex has acquired a special spot in the heart of abstract game aficionados. Its purity and depth has lead Jack van Rijswijck to conclude his PhD thesis with the following hyperbole [15].

Hex has a Platonic existence, independent of human thought. If ever we find an extraterrestrial civilization at all, they will know Hex, without any doubt.”

Hex does not only exert a fascination on players, but it is the root of the field of connection games which is being actively explored by game designers and researchers alike [4]. The focuses of the researchers include (1) the design and programming of strong artificial players and solvers [1, 6], (2) the computational complexity of determining the winner in arbitrary positions [2, 5, 11], and (3) theoretical considerations on aspects specific to connection games such a virtual connections and inferior cells [9, 1315]. The two-player game Slither that we study in this article should not be confused with the Japanese single-player puzzle slither link which has been the object of two other independent papers [16, 17].

The paper is organized as follows. After describing the rules of the Slither game, we demonstrate via specific game positions that a few properties that typically hold in connection games may actually not hold for Slither. The last section establishes that determining the winner in a two-player game of Slither is a pspace-complete problem.

2 Rules

Slither is a two-player game starting on an empty n by n grid (or board). Let us call the players Black (or B) and White (or W). Black and White alternate moves. Before stating what a move consists of, and what the winning conditions are, we introduce some useful definitions.

Fig. 1.
figure 1

Some examples of allowed and forbidden configurations. Forbidden configurations are crossed.

As the game proceeds, squares of the board can be empty, or contain a black stone, or contain a white stone. We refer to black (resp. white) stones as the stones of player B (resp. W). We say that two squares of the board are adjacent if they are in the same row and adjacent columns, or in the same column and adjacent rows. They are king-adjacent if a chess king can move from one square to the other, and diagonally-adjacent if they are king-adjacent but not adjacent. Two stones are adjacent (resp. king-adjacent, diagonally-adjacent) if they are in adjacent (resp. king-adjacent, diagonally-adjacent) squares. For \(P \in \{W,B\}\), let \(G_P\) be the graph of which the vertices are the stones of player P placed in the board, and the edges encode the adjacent relation. That is, two vertices are linked by an edge if and only if they represent adjacent stones. Like in the game of Go, a group for player P is a maximal connected component in \(G_P\).

A move for player P consists of an optional relocation of an existing stone of P on a king-adjacent empty grid square, followed by a mandatory placement a stone of P into an empty grid square (see Fig. 2). For a move to be legal, the resulting position may not have two diagonally-adjacent stones of P that do not also have an orthogonally-adjacent stone in common (see Fig. 1). In what follows, we refer to this restrictive rule as the diagonal rule.

Black wins if they form a group with at least one stone in the first and in the last column. White wins if they form a group with at least one stone in the first and in the last row. Informally, Black wants to connect left-right and White wants to connect top-bottom (see Fig. 2b).

Fig. 2.
figure 2

Illustration of a move and a winning group in a 7 by 7 board.

As in most connection games, a swap rule is usually implemented. That is, after the first move, the second player can decide either to play themself a move and the game goes on normally, or to become first player with that very same move.

3 Elementary Properties of the Game

We now present some observations on and properties of Slither. Some of the observations made in this section have independently been pointed out earlier in the abstract game community, especially on BoardGameGeek.Footnote 1 However, we prove for the first time that the standard Slither variant cannot end in a draw, thereby settling an open-problem often raised in this community.

The concept of zugzwang appears in chess and denotes a position in which the current player has no desirable move and would rather pass and have the opponent act. A mutual zugzwang is a position in which both players would rather have the opponent play. Although zugzwangs are virtually unheard of in typical connection games, where additional moves can never hurt you, things are different in Slither.

Proposition 1

Zugzwangs and mutual zugzwangs can occur in Slither.

Proof

In Fig. 3a, if it is White (resp. Black) to play, only one move is available, moving stone on C2 (resp. C4) to a and placing a stone on c or equivalently moving to c and placing on a. Then Black (resp. White) wins by placing a stone on C2 (resp. moving stone B5 to C4 and placing a stone on b).

Fig. 3.
figure 3

Slither positions with a shortage of moves.

When John Nash discovered/invented the game Hex, one of his motivations was to find a non-trivial game with a non-constructive proof that the first player has a winning strategy in the initial position. To obtain this result, Nash developed a strategy-stealing argument which can be summed up as follows [15]. Assume for a contradiction that the second player has a winning strategy \(\sigma \) in the initial position. Then a winning strategy for the first player can be obtained as: start with a random move, then apply \(\sigma \) pretending that the initial move did not occur. If \(\sigma \) ever recommends to play on the location of the initial move, then play another random move and carry on. Given that having an additional random stone on the board cannot hurt the first player, then we have developed a winning strategy for the first player too. Since the second and first player cannot both have a winning strategy at the same time, we may conclude that our hypothesis does not hold. Therefore the initial Hex position is not a second-player win when the swap rule is not used. Nash finishes his proof by showing that there can be no draw in Hex and concludes that the initial position is a first player win.

This strategy-stealing argument can be applied to many other games including Twixt, Havannah, and games of the connect(mnk) family [10]. Since draws are not ruled-out in these games, the argument only shows that the initial situation is not a second-player win. However, the strategy-stealing argument cannot be applied to Slither.

Proposition 2

Nash’s strategy-stealing argument does not apply to Slither.

Proof

Consider the White zugzwang position in Fig. 3a. Had the A4 square not been occupied by a White stone, White would have a winning move: move B4 to b and place a stone on c. Since there are positions where having one too many stones on the board can make a player lose the game, Nash’s strategy-stealing argument does not apply.

Therefore, there is no theoretical indication yet that Slither is not a second-player win on an empty board. However, in practice it is a huge advantage to play first, so much that if the swap rule is used, it is recommended to swap no matter where the first move is played, including corner locations. The Slither-specific intuition behind this practical advice is that the game is dynamic and a player can bring back a stone from a corner towards the center, moving it closer every turn.

Proposition 3

There exist positions in which a player has no legal move.

Proof

For instance, Black has no legal move in the position Fig. 3b.

Fig. 4.
figure 4

Drawn Slither positions on non-planar boards.

Proposition 4

Draws are possible when Slither is played on a cylinder or on a torus.

Proof

In Fig. 4a (resp. Fig. 4b), if black (resp. black and white) sides are connected, then both players have no legal moves.

That draws are possible for some exotic boards should enhance the accidental aspect of our result on rectangular boards. There are probably no fundamental reasons why the following result is true, and the proof, which we defer to the appendix, consists of a large case analysis on the consequences of forbidding diagonal configurations and the possibility of moving stones.

Theorem 1

Draws are not possible in Slither on rectangular boards.

We end this section, remarking that the connection tactics (for instance ladders) are quite different in Slither than in other connection games. For example, in Fig. 5, White is connected to the bottom. Black has to defend on A1, but White can play on C1 and then Black has to play on B1, White plays on C2, Black answers on B2 and White ends the game moving stone A2 to B3 and placing a stone on C3. This last winning move for White is typical in Slither and would obviously not be allowed in a game like Hex.

Fig. 5.
figure 5

Ladders.

4 Computational Complexity

Here, we show that deciding if one player has a winning strategy from a given position is intractable.

A staple in proofs of pspace-hardness for two-player games seems to be generalized geography [12]. This problem has been used to show the intractability of games as different as Hex [11], Amazons [7], Bridge [3], and many more [8]. Our result for Slither also relies on generalized geography, albeit indirectly since we reduce from Hex.

Theorem 2

It is pspace-complete to decide which player has a winning strategy from a given Slither position.

Proof

The membership of this problem to pspace boils down to noticing that the length of a game is bounded from above by the number of empty squares. Indeed, at each move, one stone is added to the board. Thus, a minimax depth-first search uses a polynomial amount of space.

We now present a reduction from Hex which is known to be pspace-complete (see [11]). A hexagonal cell of Hex is encoded by the gadget depicted in Fig. 6. More precisely, an empty cell (resp. a cell containing a black stone, resp. containing a white stone) is transformed into the portion of position of Fig. 6a (resp. Fig. 6b, c). The cell gadgets are glued together and attached to the edges of the board as described in Fig. 7. The empty squares which do not correspond to one of the eight squares designated by letter a to h in Fig. 6a can be filled with black stones. For convenience, we do not represent those stones.

Fig. 6.
figure 6

The cell gadget.

Fig. 7.
figure 7

An empty 3 by 3 Hex board reduced to a Slither position.

Observation 1

When a player places a stone in an empty cell gadget (that is, on a square marked with letter a to h), they create a configuration which is forbidden by the diagonal rule. Thus, they should also move one of their stones in the same cell gadget.

Lemma 1

In a black cell \(\mathcal C\) (see Fig. 6b), White cannot prevent Black from having a group containing stones in w, y, and u.

Proof

Black stones on w and y are already in the same group. Because of the diagonal rule, White cannot place a stone in cell \(\mathcal C\) and move a stone in another cell gadget. By Observation 1 and the previous remark, if White moves a stone in cell \(\mathcal C\), but decides to place a stone in another cell gadget, they can only do so in a white cell, which turns out to be useless. Thus, White might as well place a stone and move in cell \(\mathcal C\). After their move, White should occupy square c; otherwise, Black places a stone on c and thereby connects their group containing u to their group containing w and y.

There are three ways for W to occupy square c: (1) move stone on B4 to c, or (2) move stone on D3 to c, or (3) place a new stone on c. The first option cannot be extended into a legal move. Indeed, the diagonal rule would impose that a stone is placed on d, to connect the two diagonally-adjacent white stones on c and D3. But then white stones on d and E5 would form a forbidden configuration. In the second option, White cannot place a stone on D3 nor on d, because of the diagonal rule. And Black’s next move would consist of moving the stone on D2 to D3, and placing a stone on d, which connects u to w and y. Finally, in the third option, White is forced to move their stone in D3 to a square other than d. And Black connects in the same manner.

Since the cell gadget is symmetric, the following holds similarly.

Lemma 2

In a white cell (see Fig. 6c), Black cannot prevent White from having a group containing stones on v, x, and z.

The following observation is outlined by Fig. 7.

Observation 2

When playing in a empty cell gadget, Black cannot do more than connecting u, w, and y, and White cannot do more than connecting v, x, and z.

From the empty cell gadget, Black can move stone E4 to b and place a stone on a, resulting in the black cell configuration. By Lemma 1 and Observation 2, it is the optimal play within this cell. Similarly, the optimal play for White in a given empty cell, is to move stone D3 to c and place a stone on a, yielding the white cell. Thus, having chosen the cell gadget where to play, the optimal move is to connect six paths going from this cell to the six adjacent cells in a hexagonal paving (see Fig. 7). Hence, the built Slither position simulates a game of Hex, and so, Slither is as hard as Hex.

5 Conclusion

This paper establishes the pspace-completeness of a connection game, Slither. Although the diagonal rule and the relocation part of a move may seem, at first sight, somewhat artificial, they provide a mechanism to avoid draw possibilities. As such, they can be seen as a direct consequence of bringing Hex to a more natural grid board. Both rules are necessary: the diagonal rule prevents a straightforward drawing strategy, and draws would arise quite often if it was not for the right to relocate stones (see, for instance, Figs. 3a, b, and 7).

Slither is not the first connection game played on a grid, but unlike in Twixt where nodes can have direct links to up to 8 neighbors, the largest number of neighbors of a node is 4 in Slither. Going from an hexagonal paving to a grid lowers the number of neighbors of each node, the degree. This change rules out a direct reduction from Hex as was possible for twixt [2]. Our main technical contribution is a hybrid connection mechanism between 6 groups on a degree 4 grid: in one move, a player connects physically two pairs of paths together and connects virtually the third pair to the other two. Our main practical contribution is to have ruled out the possibility of a draw on rectangular boards.

A seemingly reasonable heuristic consists of playing the first move of a shortest sequence leading to victory, supposing the opponent passes. We leave as an open question if such a shortest sequence can be efficiently computed. This problem might already be np-hard. In fact, deciding if such a sequence exists at all, is not necessarily easy to do.