
Nim is a two-player mathematical strategy game played with rows of matchsticks, classically 1, 3, 5 and 7. On each turn you remove any number of sticks from a single row; under the classic misère rule, whoever takes the last stick loses. Games are pure skill and finish in two to five minutes.
Reviewed & updated
Nim is ancient in spirit, but its modern fame is mathematical: in 1901 Harvard’s Charles Bouton published the complete solution and coined the name, making Nim the first game ever fully solved in print. Fifty years later it became the first game a computer was built to play, when Ferranti’s NIMROD, a wall of lights and switches, took on the public at the 1951 Festival of Britain and beat nearly everyone who tried it.
The game reached popular legend through the 1961 film Last Year at Marienbad, whose characters play the 1-3-5-7 layout obsessively; that arrangement has been called the Marienbad game ever since. Nim also seeded an entire branch of mathematics, combinatorial game theory, where the Sprague-Grundy theorem shows every impartial game is secretly a game of Nim.
Nim is a pure duel with no luck: four rows of sticks, alternating turns, and one simple move — take sticks from a single row. The whole game is deciding how many.
Nim is a family: the 21 game (take 1-3 from a single pile of 21), Northcott’s game on a checkerboard, and turning games like Mock Turtles are all Nim in disguise via the Sprague-Grundy theorem. Layouts vary from three rows (3-5-7) to five and more; every layout is solved by the same nim-sum arithmetic, which is why the game remains a staple of mathematics classrooms.
Play Nim on Arcadia to learn the nim-sum, spring the misère trap, and out-count NIMROD itself.
The XOR of all row sizes written in binary. If the nim-sum after your move is zero, your opponent is in a losing position no matter what they do. This 1901 result by Charles Bouton made Nim the first fully solved game.
Only at the very end. Play the normal zero-sum strategy until your move would leave nothing but single sticks, then leave an odd number of them so your opponent must take the last one.
It depends on the layout. The classic 1-3-5-7 start is balanced (nim-sum zero), so the second player wins with perfect play — which is why experts politely let you move first.
The first computer built to play a game: a Ferranti machine exhibited at the 1951 Festival of Britain that played Nim with lights for sticks and beat almost every human challenger.
Yes. Arcadia offers free Nim in your browser with misère and normal rules and a perfect-play NIMROD difficulty — no download or account required.
Pure skill. There are no dice and no hidden information, and Charles Bouton proved in 1901 that every position is either winning or losing for the player to move, with an exact rule for telling which. The only luck in Nim is an opponent who miscounts.
Nobody knows who invented it — simple take-away games appear in many cultures and are probably very old. What is documented is the mathematics: Charles Bouton of Harvard named the game and published its complete solution in 1901. The name is usually traced to the German nimm or the archaic English nim, both meaning “take”.
It is misère Nim with the 1-3-5-7 layout, named after Alain Resnais’s 1961 film Last Year at Marienbad, in which a character plays it repeatedly with matchsticks and never loses. The film made that layout the standard image of Nim, and it briefly turned the game into a popular craze.
It is the result that makes Nim the measuring stick of game theory: Roland Sprague (1935) and Patrick Grundy (1939) independently proved that every impartial game under normal play is equivalent to a single Nim heap of some size. In other words, once you can play Nim perfectly, you hold the key to a whole class of games.
Historians usually say no, because NIMROD displayed the game on panels of light bulbs rather than a screen — screen-based candidates such as OXO (1952) and Tennis for Two (1958) came later. NIMROD’s claim is different: built by Ferranti for the 1951 Festival of Britain, it was the first computer constructed purely to play a game.
The 21 game is Nim in disguise: a single pile of 21, take one to three per turn, and whoever takes the last one loses. The winning method is to always leave your opponent a pile of one more than a multiple of four — 17, 13, 9, 5 and finally 1 — so every pair of moves shrinks the pile by exactly four.
No. Every turn removes at least one stick, so the standard 1-3-5-7 game must end within 16 moves, and there is no repetition or stalemate to hide behind. One player always has a forced win from any position — the whole question is whether they can find it.
Two to five minutes is typical: the standard layout holds only 16 sticks, so games cannot drag. On Arcadia you can play free in your browser with misère or normal rules, against a Casual opponent that makes human mistakes or a perfect-play NIMROD difficulty.
MAIN MENU
PvP Games
Battleship
Crazy Eights
Dots & Boxes Blitz
Gomoku
Ludo
Snakes & Ladders
YahtzeeFree Games
Alquerque
Backgammon
Bagh-Chal
Balut
Battle for Tokyo
Battleship
Bingo
Bridge
Bunco
Checkers
Chess
Chomp
Crazy Eights
Cribbage
Dara
Derby Dash
Dominoes
Dots & Boxes Blitz
Durak
Fanorona
Farkle
Fox and Hounds
Generala
Go / Weiqi
Gomoku
Hazard
Hex
Higher or Lower
Hnefatafl
Hounds and Jackals
Indian Rummy
Ludus Latrunculorum
Liar's Dice
Ludo
Mahjong Solitaire
Mancala
Nim
Nine Men's Morris
Onitama
Patolli
Peg Solitaire
Pentago
Pente
Pig
Pylos
Quoridor
Reversi
Royal Game of Ur
Scratch Cards
Seega
Senet
Ship, Captain, Crew
Shut the Box
Snake
Snakes & Ladders
Space Blaster
Spades
Sugar Pop
Tile Rummy
Tower
Truco
War
Word Spy
XII Scripta
YahtzeeNEED HELP?