Best Free Nim Game
Take matches from the rows and force the computer to grab the very last one.
Level 1
press P to pause
Love Best.Free? Share it
How to play
- Pick a row. Click a match to remove it and every match to its right in that row.
- Take turns. You and the computer alternate, each removing any number from one row.
- Dodge the last match. Force the computer to take the final match — whoever takes it loses.
About Nim
Nim is the timeless mathematical strategy game. Several rows of matches sit on the table, and you and the computer take turns removing as many matches as you like from a single row. The catch: whoever is forced to take the very last match loses. Behind its simple rules hides the elegant nim-sum strategy — beat the computer by leaving it in a losing position. No signup.
Frequently asked questions
The board has several rows of matches. On your turn you remove any number of matches you like — but all from a single row. You and the computer alternate turns. In this misère version, the player forced to take the very last match loses.
Click a match and it is removed together with every match to its right in the same row. So clicking the first match in a row clears the whole row, while clicking the last match removes just that one.
Optimal Nim play is based on the nim-sum, the bitwise XOR of the row sizes. You generally want to move so the nim-sum becomes zero, with a special adjustment near the end of a misère game so your opponent is the one left taking the last match.
It depends on the difficulty. On Easy the computer plays loosely and makes mistakes you can exploit, on Normal it mostly plays the optimal nim-sum strategy, and on Hard it plays perfectly — if it has a winning position, it will not let it slip.
Misère play means the goal is reversed: instead of trying to take the last object, you are trying to avoid it. The player forced to remove the final match is the loser, which subtly changes the optimal endgame strategy.
Completely free, with no signup, no download and no paywall — it loads and runs entirely in your browser, and nothing is uploaded.
Yes. It runs in your browser, so Nim works on phones and tablets as well as desktop — there is no app to install.
No. Nim works with no signup at all; an optional free account only exists to unlock higher usage limits.
Usually just a few seconds for a typical file — Nim starts working the moment you give it your input.
Your input is processed in memory and never stored, so nothing is left behind once you have your result.