2 September 2026
255,168 Games, One Correct Result: The Maths Behind Tic-Tac-Toe
Tic-tac-toe is the only game most people ever finish. Not win — finish. Somewhere around the age of eight, children stop playing it, and they stop for a reason that is genuinely impressive: they have worked out, without being told and without any formal analysis, that there is nothing left in it. Between two people who are paying attention, every game is a draw. That is a real mathematical result, and a classroom full of seven-year-olds arrives at it independently every year.
The numbers behind that intuition are worth seeing. If you ignore the fact that games end early, there are 362,880 ways to fill nine squares in order. Once you account for games stopping the moment somebody makes three in a row, there are exactly 255,168 possible games. Of those, X wins 131,184, O wins 77,904, and 46,080 end in a draw.
Look at that last figure for a second, because it is the whole game in one ratio. If both players moved completely at random, only about 18 percent of games would be drawn. Against correct play, 100 percent of them are. The distance between 18 and 100 is made entirely of mistakes — which is another way of saying that in tic-tac-toe you never win, your opponent loses.
The reason the game could be solved at all, long before computers, is symmetry. There are nine opening moves, but a 3×3 square can be rotated four ways and flipped, which means all four corners are the same move and all four edges are the same move. There are only three genuinely different first moves: centre, corner, edge. Apply that reasoning all the way down and the entire game collapses to 765 essentially distinct positions. Seven hundred and sixty-five fits in a notebook. That is the difference between tic-tac-toe and chess, and it is a difference of scale rather than of kind.
That same counting explains the opening. The centre square sits on four of the eight winning lines, a corner sits on three, and an edge on only two. There is no deep theory to memorise — the strongest square is simply the one involved in the most ways to win. Take the centre when it is free, take a corner when it is not, and leave the edges alone unless you are blocking something.
Winning, when it happens, almost always comes down to one idea: the fork. A fork is a move that creates two threats at once. Your opponent can block one of them and only one, so the other wins on your next turn. Every victory between two competent players is a fork, and every loss is a fork that was allowed to form two moves earlier. Learning to see one coming is the entire skill, and it is the same skill that shows up as a double threat in checkers, connect four, and — in a much less obvious costume — chess.
The classic fork is easy to build. Take a corner. If your opponent answers in the centre, take the corner diagonally opposite. You now own two opposite corners with nothing threatening on the board, which feels like you have wasted a move; you have not. Whatever your opponent plays next, you will usually end up with a third corner, and three corners give you two open lines running through the empty edges between them. Two lines, one block, one win.
It is worth being honest about the computer opponent on CerdikCerdik, because this is exactly where it can be beaten. It follows a short priority list: take a winning move if one exists, block yours if one exists, otherwise take the centre, otherwise a random corner, otherwise anything. That makes it genuinely solid — it will never miss an immediate win or an immediate block, so sloppy play always loses. But the list looks exactly one move ahead. It cannot see a threat being assembled, only a threat that has already arrived. Build the corner fork and it walks into it every time, which makes it a good opponent to learn on: it punishes carelessness and rewards the one idea you are actually trying to learn.
The history is stranger than the game deserves. Three-in-a-row goes back at least to the Roman Empire, where a version called terni lapilli was played with three counters each that were slid around the board rather than added to it — a nine-square game that never fills up, which is a rather better game than the one we inherited. The British called it noughts and crosses long before America called it tic-tac-toe.
It also has an outsized place in computing. In 1952, a Cambridge doctoral student named A. S. Douglas wrote OXO for the EDSAC, a room-sized machine with a cathode ray tube for a display, so that a person could play noughts and crosses against a computer. It is one of the earliest graphical computer games anyone built, and it was written as an illustration for a thesis about how humans and machines interact rather than as entertainment.
Better still is what Donald Michie did in 1961, without a computer at all. He built MENACE — the Matchbox Educable Noughts And Crosses Engine — out of 304 matchboxes, one for every board position the machine might face. Each box held coloured beads, one colour per legal move. To take a turn you shook the box for the current position and drew a bead at random. If MENACE lost the game, you removed the beads it had played; if it won, you put extra beads of those colours back in. After a couple of hundred games the losing moves had physically disappeared from the boxes and the machine played very nearly perfectly. Nothing in it understood anything. It just became more likely to repeat what had worked.
That is reinforcement learning, built out of cardboard in 1961, and it is still the clearest explanation of machine learning anyone has managed. You can run a stripped-down version at a kitchen table with paper cups and sweets, and a child who has watched their own bad moves get eaten out of the cups understands something about how modern systems learn that a great many adults do not.
Which is the real answer to why a solved game is still worth ten minutes. For a young child it is the first game where thinking ahead visibly beats not thinking ahead, and the first place they meet the idea that one move can do two jobs at once, and that a position can already be lost several moves before it ends. That is not a small lesson, and every strategy game they play afterwards is a variation on it.
Play a few rounds at cerdikcerdik.com/games/tic-tac-toe — try to build the fork rather than just avoid losing, and switch to pass-and-play when there is someone else around, because a human is the only opponent who will surprise you. When the board starts feeling too small, cerdikcerdik.com/games/connect-four runs on exactly the same threats and blocks on a grid nobody has memorised. And if you like the feeling of a game where the right move can be proved rather than guessed, we made that case for a different board at cerdikcerdik.com/blog/minesweeper-logic-not-luck.
Continue learning →