Games of the world

Nim

Appeared: 1901Origin: CambridgePlayers: 2

The matchstick game, where whoever takes the last one… wins or loses

Puzzles
Nim
Nim — the Nimrod computer (reconstruction), Computer Games Museum, Berlin
Chuck SMITH — CC BY-SA 3.0 — Wikimedia Commons

In brief

Nim is a strategy game in which two players take turns removing objects, matches, counters or sticks, from one or more piles. Depending on the rule chosen, whoever takes the last one wins or loses. Games of this kind have existed for a long time, but it was the American mathematician Charles Bouton who, in 1901, named it and found its winning strategy.

The story

Bouton, a professor at Harvard University, showed that you can always tell who will win by writing the sizes of the piles in binary, with 0s and 1s. The game became a famous example in game theory. In 1940 an electric machine, the Nimatron, challenged visitors to the New York World’s Fair, and almost always won.

In 1951 the Nimrod computer, built in England for the Festival of Britain, also played Nim: it was one of the first computers designed to play a game. In France the game became known through the 1961 film “Last Year at Marienbad” and the sticks game of the TV show Fort Boyard.

How to play

In the simplest version you lay out 20 matches; each player removes 1, 2 or 3 in turn, and whoever takes the last one loses. The winning strategy is to leave your opponent 1, 5, 9, 13 or 17 matches. With several piles, Bouton’s strategy relies on adding the sizes written in binary without carrying.

Did you know?

You can challenge the computer at Nim on the “Play” page: in expert mode it uses the winning strategy!

Sources: The museums and institutions mentioned; Encyclopædia Universalis; Encyclopædia Britannica; work by historians of games; texts written for this site.

In the same family: Puzzles