Tic-tac-toe is one of those rare games where the rules fit on a napkin and the strategy can fill a textbook. The 3×3 grid, two marks (X and O), and a single win condition — three in a row — have been enough to occupy mathematicians, computer scientists, and anyone with a pencil and a bored minute since at least the 1st century BCE.
The game's ancient origins are disputed, but versions of crossed lines and marks appear in Roman history around 100 BCE in a game called terni lapilli. The modern name comes from a 19th-century British children's game where a pencil was placed between the fingers and thrown at a grid while the eyes were closed — essentially a precursor to the "random placement" variant. By the 20th century, the standard two-player alternating version had become the definitive form.
What makes tic-tac-toe genuinely interesting from a computational perspective is that it was one of the first games to be played on a computer. In 1952, British computer scientist Alexander Douglas wrote OXO (also called Noughts and Crosses) as part of his PhD thesis on human-computer interaction at the University of Cambridge. It ran on the EDSAC computer, displayed on a cathode ray tube screen, and allowed a human to play against the computer. OXO is considered one of the first graphical computer games ever made.
The Mathematics of the Game
There are 255,168 possible unique games of tic-tac-toe (counting rotations and reflections as distinct). Of those, 131,184 are first-player wins, 77,904 are second-player wins, and 46,080 are draws. When both players play optimally, the result is always a draw — making tic-tac-toe a "solved" game. There is no room for creativity at the expert level; there is only correct play and incorrect play.
The minimax algorithm — the engine behind this game's Unbeatable AI — was formalised by John von Neumann in 1928 but became computationally practical in the 1950s. For tic-tac-toe, the game tree is small enough that a computer can evaluate all possible futures from any board position in milliseconds. The AI assigns a score to each possible outcome (win, loss, draw), then selects the move that maximises its minimum guaranteed score. Against this algorithm, the best result a human player can achieve is a draw.
Strategy Tips
- Start in the centre. The centre participates in four winning lines, more than any other square. Against human opponents, opening in the centre gives the most winning opportunities.
- Corners beat edges. Corner squares participate in three winning lines; edge squares in only two. If the centre is taken, corners are your next best option.
- Watch for forks. A "fork" is a move that creates two simultaneous threats. Your opponent can only block one. Creating fork opportunities — and blocking your opponent's potential forks — is the key tactical skill in human vs human play.
- On Hard mode, probe the AI's error windows. Hard mode deliberately plays sub-optimally about 30% of the time. Use aggressive corner-first strategies to maximise the chance of catching an AI mistake before it recovers.