How Tic Tac Toe Is Used to Teach AI to Machines
August 12, 2026 · TicTacToe.now
- In 1961, engineer Donald Michie built MENACE, a "computer" made from 304 matchboxes, to learn tic tac toe using nothing but beads and trial and error.
- MENACE improved by removing beads for losing moves and adding beads for winning ones - An early, hands-on example of what's now called reinforcement learning.
- It worked without a single line of code or a single transistor, decades before "machine learning" was a common phrase.
- Tic tac toe is still the first project in a lot of intro AI courses, for many of the same reasons MENACE used it in 1961.
A Computer Made of Matchboxes
In 1961, a researcher named Donald Michie wanted to prove something simple. A machine could learn to play a game without anyone programming a strategy into it. He didn't have a computer handy that could pull this off cheaply. So he built one out of office supplies instead.
Meet MENACE
MENACE is short for Matchbox Educable Noughts And Crosses Engine. It was 304 matchboxes glued together. Each box stood for one possible board position that tic tac toe can reach, following the same basic rules everyone already knows.
What Was Hiding Inside Each Box
Every matchbox held a handful of colored beads. Each color mapped to one of the open squares on that box's board position. To make a move, a human operator shook the matchbox that matched the current board. They pulled out a bead at random and played whatever square that color pointed to. That random pull was the entire processor.
MENACE by the Numbers
- 304 matchboxes, one for each board position MENACE could face
- 0 lines of code and 0 transistors
- Just a handful of colored beads and one patient human operator
- Built in 1961, decades before "machine learning" was a common phrase
How MENACE Actually Learned to Play
The Five-Step Learning Loop
MENACE repeated the same loop every game. That loop is a simple form of trial and error learning. It's the ancestor of what today's researchers call reinforcement learning.
- Before a game, every matchbox starts with a roughly even mix of bead colors - No square is favored yet.
- MENACE plays a full game against a human, one random bead pull per matchbox used along the way.
- If MENACE wins, extra beads get added back into every matchbox it used, in the colors of the moves it played - Those moves get more likely next time.
- If MENACE loses, the beads for the losing moves get removed instead, making that mistake less likely to repeat.
- Play enough games, and the boxes slowly fill up with beads for good moves and empty out of beads for bad ones.
No Rulebook, Just Results
Nobody ever told MENACE the rules of good strategy. It never "knew" that corners are stronger than edges. It never learned that the center square matters more than the rest.
It just noticed, one clumsy loss at a time, that certain beads kept leading to empty boxes. So it stopped picking them as often. After a few hundred games, Michie's matchbox pile was playing shockingly well - Not perfectly, but well enough to beat plenty of humans.
Why That Mattered in 1961
Reward the Outcome, Skip the Rulebook
This was years before cheap access to computers that could run this kind of experiment digitally. It was decades before "machine learning" was a phrase people used casually. MENACE proved a point that still sits underneath a huge chunk of modern AI: a system doesn't need to be told the right answer. It just needs to be told whether its last answer worked out.
That idea now has a name: reinforcement learning. It comes down to three simple ingredients.
- An outcome - Did the last game end in a win or a loss?
- A reward signal - A simple pass-or-fail message the system uses to judge what it just did
- Repetition - Enough games for the good moves to rise and the bad ones to fade
Reinforcement learning now powers everything from game-playing AI to robots learning to walk.
MENACE vs. Brute-Force Search
MENACE learned by trial and error, but that isn't the only way to teach a machine tic tac toe. The other classic approach is brute-force search - Checking every possible move in advance instead of learning from what happened last time. Our math and game theory page covers that approach in detail. Here's how the two stack up side by side:
| MENACE (Trial and Error) | Brute-Force Search | |
|---|---|---|
| How it decides a move | Picks a bead shaped by past wins and losses | Checks every possible move before playing |
| Needs to play games first? | Yes - Gets better with practice | No - Already "knows" the whole game |
| What it needs to work | A reward signal and enough repetition | Enough computing power to check every branch |
| Modern example | Deep reinforcement learning | Minimax search |
Not What People Pictured as a Computer
MENACE also mattered because it looked nothing like a computer. Back then, people pictured wires, screens, and blinking lights. MENACE had none of that.
That made the underlying idea easier to trust. Anyone could watch it happen bead by bead, instead of taking someone's word for it.
Why Tic Tac Toe Is Still a CS Classroom Favorite
Small Enough to Finish Before Class Ends
Sixty-some years later, tic tac toe hasn't left the intro AI syllabus. MENACE's reasons for using it are basically still true today. A few reasons it keeps getting picked:
- The whole game fits in a small enough space that a first AI project can finish running before class ends.
- A student gets to watch their program improve, fail, and improve again - The whole reinforcement learning loop - Without needing a supercomputer.
- There's no semester of setup. A working version can run in an afternoon.
Easy Enough to Debug by Hand
It also gives beginners something rare: a way to check their work by hand. If a program's search or learning process misbehaves on a nine-square board, a student can trace exactly what went wrong.
Debugging that same kind of mistake on a chess engine could take a week. Our Hard mode here uses a related but different approach called lookahead. It calculates every possible reply in advance, instead of learning through trial and error. Comparing the two approaches side by side is a common classroom exercise in its own right.
What a Simple Game Teaches That a Complicated One Can't
Why Chess and Go Make Poor First Projects
Chess and Go are the games people usually picture when they think of AI beating humans, and rightly so. Those wins were real milestones. But they make poor first projects, because there's too much going on to see the underlying idea clearly.
Tic tac toe strips the lesson down to its studs. Here's an outcome. Here's a reward signal. Here's what changes because of it. Once a student truly understands that loop on a small board, scaling it up gets easier. Try it on the 5x5 board next. At that point it's mostly an engineering problem, not a conceptual one.
MENACE's Real Legacy
That's really MENACE's legacy. Not the specific matchboxes - Nobody's building those anymore. It's the demonstration that learning from outcomes, one loss at a time, works even with the crudest possible hardware.
The Machine That Learned From Losing
Losing Without Embarrassment
What's easy to miss about MENACE is that it never got embarrassed. Every loss just meant fewer beads in a box. Fewer beads meant a slightly smarter machine for the next game.
If a pile of matchboxes can learn to avoid a fork just by losing to enough of them, that's a good reminder. Machines getting better at this game started with something that learned to win by being comfortable losing, over and over, until it wasn't losing anymore.
From Cardboard to Silicon
That's still exactly how modern AI training works. The only real difference is scale.
- Hardware: 304 cardboard matchboxes in 1961, racks of processors today
- Memory: Colored beads then, millions of numeric weights now
- Training games: A few hundred then, millions or billions now
- Feedback signal: Add or remove a bead then, adjust a network's weights now
Silicon stands in for cardboard now, and millions of games stand in for a few hundred. But the core idea Michie proved in 1961 hasn't changed at all.