About Nim
Nim is a two-player game played with several heaps of sticks. On your turn you take as many sticks as you like from a single heap, and players alternate. The twist is in the goal: whoever is forced to pick up the very last stick loses the game.
It looks like a casual game of chance, but Nim is famous for being completely solved. Mathematicians worked out a perfect strategy in 1901, and it rests on a piece of binary arithmetic. That hidden depth is the fun of it. The rules are trivial, yet a player who knows the secret can win from the right positions every single time.
You can play Nim free in your browser against the computer with no download. You will understand the rules in seconds, and beating the easier levels is straightforward. The higher levels play the perfect strategy, so out-thinking them is a real accomplishment, and it means you have effectively done the math in your head.
Controls
You play by removing sticks. On your turn, choose one heap and take any number of sticks from it, from a single stick up to the whole heap. Then play passes to your opponent.
The rules are as simple as a game gets:
- Your move is always to remove at least one stick from exactly one heap. You can never take from two heaps in the same turn.
- The losing move is taking the final stick on the board. So the whole game is about forcing your opponent into the position where they have no choice but to take it.
Because the game is fully solved, whether a position is winning or losing is fixed, so the skill is in steering toward the winning ones.
Against the computer, the difficulty rises across eight levels, with the top levels playing the perfect strategy.
Tips
- Aim to leave your opponent one stick on their turn to lose. Since taking the last stick loses, the ideal is to leave a single stick for your opponent to be forced to take, so always look ahead to who ends up cornered.
- Think about balance between heaps. The winning strategy is about keeping the heaps in a balanced state, so try to make moves that leave the piles matching or paired rather than lopsided.
- Watch the endgame closely. With just a couple of heaps left, count precisely, because a single stick in the wrong place decides the whole game and small miscounts are how wins slip away.
- Force the reply you want. The strongest moves are the ones that leave your opponent with no good answer, so look for a move that limits their options rather than just grabbing sticks.
- Learn from the computer's perfect play. The top levels never blunder, so paying attention to how they respond to your moves teaches you the winning patterns better than any explanation.
- Don't just take the most sticks. Grabbing a big heap feels powerful but often hands your opponent a winning position, so the right move is frequently a small, calculated one.
Frequently asked questions
Is Nim free to play?
Yes. You can play as much as you want with no download and no account.
How do you play Nim?
There are several heaps of sticks. On your turn you remove any number of sticks from a single heap, and players alternate. Whoever is forced to take the last stick loses.
How do you win at Nim?
You win by leaving your opponent in a losing position, ideally forcing them to take the final stick. There is a known perfect strategy based on keeping the heaps in a balanced state.
Is Nim a game of luck?
No. Nim is completely solved, meaning that from most positions, a player who knows the strategy can always win. That is what makes beating the top computer levels a genuine test of skill.
Can I play Nim on my phone?
Yes. It runs in any modern mobile browser with tap controls, so it works well on phones and tablets.
How do I get better at Nim?
Focus on leaving balanced heaps and forcing your opponent toward taking the last stick, rather than grabbing the most sticks. Watching how the perfect-playing top levels respond will teach you the winning patterns.