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 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, then shrink that row to the XORed size. Try each of the three rows.

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

Try it in Play →