How to play Nim
- The stones are laid out in rows. On your turn, take one or more stones from a single row. Tap a stone to select it and every stone to its right, then press “Take”. The number on the left shows how many stones are left in that row.
- Players take turns. With “Last stone loses”, the usual rule, the player who has to take the last stone loses. To play the other way, also called normal play, set “Last stone” to “wins” in Settings: whoever takes the last stone wins.
- Choose how to play with the tabs at the top. Play the computer on Easy, Normal or Hard (change it with the Level button), or choose 2 Players to share one device. Before your first move you can let the computer go first.
- Play a friend online. Choose the Online tab, pick the stones and rule in Settings, and create a link. Send it to a friend; when they open it and press Play, the game starts on both devices. The player who made the link goes first in game 1, then you alternate. No sign-up or download needed.
- In Settings, choose the layout: the classic 1-3-5-7 pyramid, 3-4-5, a random set of 3 to 5 rows, or the 21 Game: one pile of 21 stones where you take 1, 2 or 3 at a time.
- The Daily puzzle is the same for everyone. You move first against the Hard computer, and the position can be won. Find the winning moves! The computer never slips, so you’ll know right away when a move lets it win. Then you can press Undo to go back to before that move (the result shows how many times you used it).
- On a computer, move between stones with the arrow keys, press Enter or Space to select, T to take, H for a hint, and U or Ctrl+Z to undo. Your game is saved, so you can come back later.
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.