One heap per move
A legal move changes only one non-empty heap. You may remove one counter or the entire selected heap, but you cannot split a take between heaps. Empty heaps remain out of play while the other heaps continue.
Take the final counter by leaving the computer a losing combination of heap sizes.
Your unfinished game is saved only in this browser.
Take the final counter by leaving the computer a losing combination of heap sizes.
Complete guide
Nim is a complete-information subtraction game. Several heaps begin on the table, each move removes any positive number of counters from exactly one heap, and the player taking the final counter wins.
A legal move changes only one non-empty heap. You may remove one counter or the entire selected heap, but you cannot split a take between heaps. Empty heaps remain out of play while the other heaps continue.
The strategic value of a position is the bitwise exclusive-or, or nim-sum, of its heap sizes. A zero nim-sum gives the next player no move that preserves zero; a nonzero position normally has a move that returns zero to the opponent.
Two visually similar heaps are not automatically safe. Binary place values determine the useful reduction, so the best move may leave unequal heaps. Count the exact counters removed and re-evaluate after every computer reply.
When only one heap remains, take it and win. With two heaps, equalizing them usually hands a zero position to the opponent. Earlier in the game, inspect the high binary bits before committing a large removal.
No. Every turn selects exactly one heap and removes one or more counters from it.
It is the bitwise XOR of all heap sizes. It is a compact way to identify the losing positions in normal-play Nim.
No. It uses a deterministic legal strategy, so the same position always produces the same reply.