Nim: History, Rules & Strategy
Nim is one of the oldest known strategy games, with origins traced to ancient China. The complete mathematical theory was published by Charles Bouton at Harvard in 1901, making it one of the first games solved by mathematical analysis. Nim is foundational to combinatorial game theory — the Sprague-Grundy theorem shows that every impartial game is equivalent to a Nim position.
How to Play
Objects are arranged in rows. Players take turns removing any number of objects from a single row. The player who takes the last object wins (normal play convention).
Strategy Tips
The optimal strategy uses XOR (nim-sum): compute the bitwise XOR of all row sizes. If the result is zero, you're in a losing position with perfect play. If nonzero, there is always a move that makes the XOR zero — find it and force your opponent into the losing position. This single rule "solves" Nim.
Variations
Misère Nim reverses the goal: whoever takes the last object loses. Wythoff's game restricts moves to one row or equal-amount removal from two rows. "Multi-pile" Nim with bounded takes underlies Sprague–Grundy theory for all impartial games.
Is this game school-safe?
Yes. No chat, no accounts. Nim is a staple of math-club curricula and pairs naturally with a lesson on binary representation.