← All guidesNim · GUIDE

Nim: from the last counters to a complete strategy

Taking the most does not always win. Understand the ending first, then decide which position to leave your opponent.

2 min · RafaGonMar · October 20, 2026

Start with a single row

In this version, taking the last counter wins. With only one row left, take it all. With two equal rows, answer your opponent by making the rows equal again. When they take one whole row, take the other.

Two rows of 3 and 3:Opponent: 3, 3 → 1, 3You: 1, 3 → 1, 1You restored equality. Match what remains, rather than copying an amount without checking.

Three rows need another kind of balance

The general strategy uses the XOR sum of row sizes. XOR compares binary numbers without carrying digits. Aim to leave a zero result for your opponent. This is normal-play Nim; do not transfer the rule unchanged to the version where taking the last counter loses.

An example with 3, 5 and 7

The XOR sum is 1. Taking one counter from the row of 3 leaves 2, 5 and 7, whose XOR sum is zero. That does not let you stop thinking: every opposing move requires finding the balance again.

Practice on Pausa

The computer uses this strategy. You move first from a position with a winning continuation if you choose correctly. Hint highlights a possible move without making it. Shared-device mode lets you explore both sides. Numbers on the buttons are amounts to remove, rather than positions within the row.

For the mathematical background: Nim and Other Games by Jacob Swenberg.

More ideas for playing

Minesweeper: turn numbers into decisions →

Reversi: not every disc has equal value →

HECHO CON CALMA · MADE WITH CARE

Enjoying your little break?

This collection is free. If you would like to support the project and future games, you can buy me a coffee.

☕ Buy me a coffee ↗