Kayles


Kayles is a simple impartial game in combinatorial game theory, invented by Henry Dudeney in 1908. Given a row of imagined bowling pins, players take turns to knock out either one pin, or two adjacent pins, until all the pins are gone. Using the notation of octal games, Kayles is denoted 0.77.

Rules

Kayles is played with a row of tokens, which represent bowling pins. The row may be of any length. The two players alternate; each player, on his or her turn, may remove either any one pin, or two adjacent pins. Under the normal play convention, a player loses when he or she has no legal move. The game can also be played using misère rules; in this case, the player who cannot move wins.

History

Kayles was invented by Henry Dudeney. Richard Guy and Cedric Smith were first to completely analyze the normal-play version, using Sprague-Grundy theory. The misère version was analyzed by William Sibert in 1973, but he did not publish his work until 1989.
The name "Kayles" is an Anglicization of the French , meaning "bowling".

Analysis

Most players quickly discover that the first player has a guaranteed win in normal Kayles whenever the row length is greater than zero. This win can be achieved using a symmetry strategy. On his or her first move, the first player should move so that the row is broken into two sections of equal length. This restricts all future moves to one section or the other. Now, the first player merely imitates the second player's moves in the opposite row.
It is more interesting to ask what the nim-value is of a row of length. This is often denoted ; it is a nimber, not a number. By the Sprague–Grundy theorem, is the mex over all possible moves of the nim-sum of the nim-values of the two resulting sections. For example,
because from a row of length 5, one can move to the positions
Recursive calculation of values gives the results summarized in the following table. To find the value of on the table, write as, and look at row a, column b:
01234567891011
0+012314321426
12+412714321467
24+412854721867
36+412314721827
48+412814721427
60+412814721867
72+412814721827

At this point, the nim-value sequence becomes periodic with period 12, so all further rows of the table are identical to the last row.

Applications

Because certain positions in Dots and Boxes reduce to Kayles positions, it is helpful to understand Kayles in order to analyze a generic Dots and Boxes position.

Computational complexity

Under normal play, Kayles can be solved in polynomial time using the Sprague-Grundy theory.
Node Kayles is a generalization of Kayles to graphs in which each bowl “knocks down” a desired vertex and all its neighboring vertices. Schaefer proved that deciding the outcome of this game is PSPACE-complete. The same result holds for a partisan version of node Kayles, in which, for every node, only one of the players is allowed to choose that particular node as the knock down target.