All games

Nim Game

Take turns removing stones. How to win

Level

Your turnLast stone loses

How to play Nim

Nim strategy

Nim has a winning strategy. With three or more rows, write each row in binary and add the columns without carrying. Leave this “nim-sum” at 0, and change only the endgame when the last stone loses. The classic 1-3-5-7 has a nim-sum of 0, so the second player can win: against Hard, press “Computer first”. In the 21 Game, make each round add up to 4 and leave 1, 5, 9, 13 or 17 stones (when the last stone loses).

History of Nim

Games of taking stones or matches in turn have been played for a long time, but the name Nim and its complete theory come from the Harvard mathematician Charles L. Bouton, who published “Nim, a game with a complete mathematical theory” in the Annals of Mathematics in 1901. Nim was also one of the first games played by machines: Westinghouse showed the Nimatron at the 1939 New York World’s Fair, and Ferranti built the Nimrod computer for the Festival of Britain in 1951. A version of Nim also appears in the 1961 French film Last Year at Marienbad. In the 1930s Roland Sprague and Patrick Grundy showed that every game of this kind can be played like Nim, which made it the starting point of combinatorial game theory.

Game settings

Stones
Random has 3 to 5 rows. In the 21 Game, take 1 to 3 stones at a time from one pile of 21.
Last stone