M,n,k-game
An m,n'',k-game is an abstract board game in which two players take turns in placing a stone of their color on an m-by-n board, the winner being the player who first gets k stones of their own color in a row, horizontally, vertically, or diagonally. Thus, tic-tac-toe is the 3,3,3-game and free-style gomoku is the 15,15,5-game. An m,''n,k''-game is also called a k-in-a-row game on an m''-by-n board.
The m,''n,k''-games are mainly of mathematical interest. One seeks to find the game-theoretic value, the result of the game with perfect play. This is known as solving the game.
Strategy stealing argument
A standard strategy stealing argument from combinatorial game theory shows that in no m,''n,k''-game can there be a strategy that assures that the second player will win. This is because an extra stone given to either player in any position can only improve that player's chances. The strategy stealing argument assumes that the second player has a winning strategy and demonstrates a winning strategy for the first player. The first player makes an arbitrary move, to begin with. After that, the player pretends that they are the second player and adopts the second player's winning strategy. They can do this as long as the strategy doesn't call for placing a stone on the "arbitrary" square that is already occupied. If this happens, though, they can again play an arbitrary move and continue as before with the second player's winning strategy. Since an extra stone cannot hurt them, this is a winning strategy for the first player. The contradiction implies that the original assumption is false, and the second player cannot have a winning strategy.This argument tells nothing about whether a particular game is a draw or a win for the first player. Also, it does not actually give a strategy for the first player.
Applying results to different board sizes
A useful notion is a "weak game", where the second player cannot win but may only draw. The weak version of a game then has just two possible outcomes instead of three.If weak is a draw, then decreasing m or n, or increasing k will also result in a drawn game.
Conversely, if weak or normal is a win, then any larger weak is a win.
Note that proofs of draws using pairing strategies also prove a draw for the weak version and thus for all smaller versions.
General results
The following statements refer to the first player in the weak game, assuming that both players use an optimal strategy.- If a particular is a draw, then with k ≥ k0 is a draw, and with m ≤ m0 and n ≤ n0 is a draw. Likewise, if is a win, then with k ≤ k0 is a win, and with m ≥ m0 and n ≥ n0 is a win.k ≥ 9 is a draw: when k = 9 and the board is infinite, the second player can draw via a "pairing strategy". A draw on an infinite board means that the game will go on forever with perfect play. A pairing strategy involves dividing all the squares of the board into pairs in such a way that by always playing on the pair of the first player's square, the second player is ensured that the first player cannot get k in a line. A pairing strategy on an infinite board can be applied to any finite board as well – if the strategy calls for making a move outside the board, then the second player makes an arbitrary move inside the board.k ≥ 8 is a draw on an infinite board. It is not clear if this strategy applies to any finite board sizes. It is not known if the second player can force a draw when k is 6 or 7 on an infinite board.k ≥ 3 and either k > m or k > n is a draw, also by a pairing strategy in the dimension not smaller than ''k''
Specific results
k = 1 and k = 2 are trivial wins, except for and- is a draw, and is a draw if m < 3 or n < 3. is a win if m ≥ 3 and n ≥ 4 or m ≥ 4 and n ≥ 3. And the first general result means that is a draw for m = n = k if k ≥ 3.
- is a draw, which means that is a draw for m ≤ 5 and n ≤ 5, and is a win, which means that is a win for m ≥ 6 and n ≥ 5 or m ≥ 5 and n ≥ 6. is a win for m ≥ 9 and a draw for m ≤ 8.
- Computer search by Wei-Yuan Hsu and Chu-Ling Ko has shown that both and are draws, which means that is a draw for m ≤ 8 and n ≤ 8. Computer search by L. Victor Allis has shown that is a win, even with one of the restrictive rules of Gomoku.
- and are both draws via pairings.
Multidimensional variant
It is possible to consider variants played on a multidimensional board instead of a bidimensional board.For the case of k-in-a-row where the board is an n-dimensional hypercube with all edges with length k, Hales and Jewett proved that the game is a draw if k is odd and
or if k is even and
They conjecture that the game is a draw also when the number of cells is at least twice the number of lines, which happens if and only if