Nim - The Strategy Game logo
The History of Nim — and Why It's Good for Your Brain

Nim is one of the oldest known two-player strategy games. Its exact origin isn't settled history — some researchers trace an early form to an old Chinese stone-picking game, and the earliest clear European references to a Nim-like game date back to the beginning of the 1500s. For centuries it was played casually, without anyone writing down a formal strategy.

1901: The Math Behind the Game

That changed in 1901, when Harvard mathematician Charles L. Bouton published a paper titled "Nim, A Game with a Complete Mathematical Theory" in the Annals of Mathematics. Bouton gave the game its modern name and proved that Nim can be solved completely using binary arithmetic — a technique now called the "nim-sum." His work is considered a founding paper of what mathematicians now call combinatorial game theory.

The Machines That Learned to Play

Nim has a surprising role in computing history. In 1939, Westinghouse displayed a machine called the Nimatron at the New York World's Fair that could play Nim against human visitors — one of the first-ever electronic games. In 1951, a Nim-playing computer built by Ferranti was shown at the Festival of Britain. Both machines were, by design, very hard to beat.

Why Play It

Because Nim has no element of luck — every position can be analyzed logically — it's a genuinely useful way to practice pattern recognition, working backward from a goal, and disciplined logical thinking. It's a small game with a real mathematical backbone, and that combination of simplicity and depth is exactly what makes it a good exercise for critical and creative thinking.

Your Wins 0
Computer Wins 0
Your move. Pick a row and remove balls from it.

Click a row's button once for each ball you want to remove from that row, then click "Computer Move" to lock in your turn.

How to Play

There are 4 rows, holding 1, 3, 5, and 7 balls. On your turn, click a row's button to remove one ball at a time — you can remove as many as you like, but only from a single row per turn. Once you're happy with your move, click "Computer Move" to end your turn and let the computer respond. Whoever is forced to remove the last ball loses. You can also let the computer move first before you make your first move — that's the key to beating it consistently.

Disclosure: Nim is a traditional strategy game, not an invention of MATHinkCo LLC or of any single author — it has been played for centuries and its mathematical theory has been public since Charles Bouton's 1901 paper. This particular page was inspired by, and built with reference to, the Nim game published by Archimedes’ Lab, whose site explicitly invites visitors to copy and modify its Nim script. Rather than reproduce that legacy 2010-era script line for line, MATHinkCo LLC rebuilt the interface and wrote its own implementation of the computer opponent, based on the published, well-known mathematical strategy for this game. No third-party images, tracking scripts, or analytics code from Archimedes’ Lab are used on this page.