How to play Nim
Take sticks from one row at a time. Whoever is left with the last stick loses.
Nim is one of the simplest games there is: a few rows of sticks, two players taking turns, and one rule about who loses. It is also one of the most famous games in mathematics. The name was given by the American mathematician Charles Bouton, who at the start of the twentieth century published a complete method for playing it perfectly. That makes Nim a rare treat: a game you can genuinely master, not just get better at.
There is no luck involved. Every position is either winning or losing for the player about to move, and the skill lies in spotting which, and in always handing your opponent a losing one. On skill.games you always move first, and every board starts in a position that you can win with perfect play, even against the strongest computer.
How to play on skill.games
- Choose how many to take: tap a stick. That stick and every stick to its right in the same row turn red, and the game asks you to tap again.
- Confirm: tap the same stick again and the red sticks are taken away.
- Change your mind: tap a different stick to choose again, or tap an empty part of the screen to cancel.
The score line shows how many sticks each side has taken so far.
Before each game the settings popup lets you choose the difficulty (Easy, Normal, Hard or Crazy) and the board. The menu button in the top-left corner pauses the game, with options to resume, start a new game or switch the sound off. An unfinished game is saved at the start of each turn, so you can continue it on your next visit.
The results screen shows the sticks each side took, how the game was decided and the number of moves, together with your record for that board and difficulty: wins, losses, win rate, current streak and best streak.
Rules
Setup. The sticks are laid out in rows. The board you pick decides how many rows there are and how long each one is.
A turn. On your turn you take sticks from one row only. You may take a single stick, several, or the whole row, but you must take at least one.
The end. This version is played misère: whoever takes the last stick on the board loses.
Decided early. Once every remaining row holds just one stick, there are no more choices to make: each player must take one stick per turn, and it is already certain who will be left with the last one. At that moment the game stops and declares the winner, leaving the remaining sticks on the board.
Strategy tips
- Think in balances. Split each row's size into the numbers 8, 4, 2 and 1 (for example, 7 = 4 + 2 + 1 and 5 = 4 + 1). If every one of those numbers appears an even number of times across all rows, the position is balanced. Hand your opponent a balanced position and they cannot keep it balanced, while you always can.
- Your first move on the default board. With rows of 3, 4 and 5, take 2 sticks from the row of 3. That leaves 1, 4 and 5: the 4s pair up and the 1s pair up, so the position is balanced.
- Keep restoring the balance. Whatever the computer takes, look for the one move that makes everything pair up again. There is always at least one when the computer has left you an unbalanced position.
- Change the plan at the very end. The misère rule only matters at the finish. As long as some row still has two or more sticks, play for balance. But if your move would leave only single sticks, leave an odd number of them, so your opponent is forced to take the last one.
- Two equal rows are a mirror. If only two rows remain and they are the same length, copy your opponent: whatever they take from one row, take the same from the other, switching to the odd-number rule at the end.
- Don't panic if you slip. If you hand the computer a balanced position, take a stick or two and wait. On the lower levels it often fails to keep the balance, and the winning chance comes back to you.
- Practise on the small board. Three rows of 3, 4 and 5 are easy to check by hand. Once the balance habit is automatic, the larger boards are the same game with more counting.
Difficulty levels
The computer always knows the perfect move; the levels differ in how often it actually plays it. When it doesn't, it takes a small bite of one or two sticks instead.
- Easy: plays the perfect move only about half the time.
- Normal: plays the perfect move about seven times in ten.
- Hard: plays the perfect move about nine times in ten, so a single mistake from you is usually punished.
- Crazy: never slips. You can still win, because the board always starts in your favour, but only by keeping the position balanced on every single move.
Modes
The Board setting chooses the layout of the sticks. Your record is kept separately for each board.
- 3 rows (3, 4, 5): 12 sticks. The default and the best place to learn the trick.
- 4 rows (2, 3, 5, 7): 17 sticks. More rows to balance and more ways to go wrong.
- 5 rows (1, 3, 5, 7, 9): 25 sticks. The long game, with plenty of counting before the end comes into view.