Nim pits you against the computer across several rows of tokens. Players take turns clearing part of a single row, and whoever removes the very last token on the board wins. It is a game of pure strategy, one that mathematics has completely solved.
Nim is played by two, you against the computer, across several rows of tokens (for example 1, 3, 5 and 7). You always move first.
On your turn, pick a single row and remove as many tokens as you like from it, at least one. Click a token: it is swept away along with every token to its right in that same row. Hover to preview what will go. The computer then answers. Whoever removes the very last token on the board wins the game.
The computer uses Sprague-Grundy theory: it computes the "nim-sum" (the exclusive-OR of the row sizes) and, whenever it can, leaves a position whose nim-sum is zero, which is unbeatable. On easy it plays at random, on medium it plays perfectly about six times out of ten, on hard it never errs. The opening deal always leaves you a winning line, your job is to find it. Undo to take a move back, or ask for a hint to see the optimal move.
Nim is a solved game: at any moment one of the two positions is winning. Your goal is to hand the computer a layout it cannot escape from, then keep it trapped.
The winning idea is the binary exclusive-OR (nim-sum) of the row sizes. Write each size in binary and add column by column without carrying: if the total is zero, the position is losing for whoever must move.
On your turn, adjust a single row so the nim-sum becomes zero. Such a move always exists when the position is not already zero; that is exactly what the computer does on hard.
When only single-token rows remain, count them: an odd number of rows wins for you under normal play. Keep this endgame in mind before rushing to grab tokens.
Here, removing the very last token on the board wins: this is normal Nim. It is not the misere variant where the final token would lose. So clear the board to your own advantage.
Yes, Nim is a completely solved game. The optimal strategy is to leave, after every move, a position whose nim-sum (the exclusive-OR of the row sizes) is zero. Whoever manages that wins for certain.
No. Each turn you touch a single row only, but you may take as many tokens from it as you wish, from one up to the whole row. You must remove at least one token.
On easy the computer plays at random; on medium it plays perfectly about six times out of ten; on hard it never errs. The opening deal always leaves you a winning line, even against the hard level.
No account or sign-up is required. Just open the page and start playing. You can undo a move or ask for a hint to see the optimal play whenever you get stuck.
Yes. Once the page has loaded, everything runs in your browser with no connection needed. Since you play against the computer, there is no daily puzzle: start as many games as you like.