Coach

Pick a case. Each one is a real decision a Nim player faces — you choose, see what actually happens, then reflect. No mascots, no rush; just the reasoning behind the move. Then test it yourself in Play or the Solver.

A real case · you decide

Nima and the Nim-sum

Nima — a player who keeps losing Nim and cannot see the pattern

The idea in play: the Nim-sum — add the rows in binary with no carrying; move to make it zero.

Three rows face you: 3, 4 and 5 tokens. It is your move, and you may take any number of tokens from a single row. Somewhere here is a move that wins — if you can find the number hiding in the position.

The Nim-sum is the bitwise XOR of the row sizes: 3 ⊕ 4 ⊕ 5. In binary that is 011 ⊕ 100 ⊕ 101 = 010 = 2. Bouton's theorem says the player to move WINS exactly when the Nim-sum is non-zero — and the winning move is any that makes it zero.

To zero a Nim-sum of 2, find a row whose size DROPS when you XOR it with 2. Here 5 (101) ⊕ 2 (010) = 7 — bigger, no good — but 4 (100) ⊕ 2 = 6 — bigger — while 3 (011) ⊕ 2 = 1 — smaller. So take the row of 3 down to 1.

The Nim-sum of (3, 4, 5) is 2. Which move hands your opponent a losing position?

Nim is not about tokens; it is about one number. Zero it on every turn and you cannot lose.

Try it in Play →