Strategy guides › Tic-Tac-Toe
How to beat Tic-Tac-Toe: forks, the Easy bot and a sure draw
The Hard bot has just put an O in the top-left corner. You have eight squares to choose from, and seven of them lose. Not “lose eventually, if you are careless” — lose by force, against a program that has already looked at every way the game can go.
Tic-tac-toe is small enough to solve completely, and it was solved long ago: with perfect play by both sides it is a draw. So the game on this site is really two games. Against Hard, your job is to never lose. Against Easy, your job is to win, and that takes a different kind of move.
What the bots actually do
We read the bot’s code rather than guessing. Hard runs a full minimax search: for every free square it plays out every possible continuation and scores the result as win, draw or loss. When several squares tie, it takes the first one in reading order (top-left, top-middle, top-right, then the next row). That tie-break makes it predictable. When it opens a round, every square is a draw on paper, so it always opens in the top-left corner. When you open in any corner, it answers in the centre. When you open in the centre, it takes the top-left corner. An edge opening gets the first drawing square in reading order: usually a corner next to you, though if you open on the bottom edge it answers on the top edge.
Easy is the same engine with a coin flip in front of it. On every move, half the time it plays a completely random free square; the other half it plays exactly like Hard. So Easy is not “a bit worse” — it is a perfect player that throws away a move at random about every other turn. Your task is to make sure that, when it throws one away, the throw costs it the game.
The one reply that holds the draw
Back to that corner O. We tested all eight replies against perfect play. Only the centre holds the draw. Every edge and every other corner lets O build a position with two threats at once, and then you can block only one.
After the centre, the rest is housekeeping: block every two-in-a-row the bot makes, and when it has nothing to block, take a corner rather than an edge. If you start the round yourself, any first move draws against Hard, but the corner or centre leaves the most room for the bot to stumble on Easy, which brings us to forks.
Forks are the whole game
A fork is a move that creates two lines of two at once, each with its third square empty. Your opponent can block one; you complete the other. Every win against a competent player is a fork, because a single threat always gets blocked.
The pattern above is worth memorising because it is the one the Easy bot walks into most. Open in a corner. Of the eight replies, seven lose against perfect play; only the centre holds. So if Easy’s coin lands on “random”, its reply is a mistake seven times out of eight, and from there a fork is forced. If you open in the centre instead, only the four edge replies lose, so the first coin flip hurts it less often, but it gets more chances to stumble later.
Your real odds against Easy
We computed the exact odds, not a simulation: for every position, the best you can do against a bot that plays randomly with probability one half and perfectly otherwise, assuming you always choose the move that gives the highest chance of winning.
| Your first move | Win | Draw | Loss |
|---|---|---|---|
| Any corner | 79.5% | 20.5% | 0% |
| Centre | 79.5% | 20.5% | 0% |
| Any edge | 78.9% | 21.1% | 0% |
| Bot opens, you never risk a loss | 60.1% | 39.9% | 0% |
Two things stand out. First, the opening barely matters: corner and centre come out exactly level (407 wins in every 512 games, to be precise), and even an edge costs you less than one game in a hundred. What matters is the follow-up — taking the square that leaves the bot the most ways to go wrong. Second, when the bot opens you win less, because you have one fewer move with which to set traps. When Easy opens, reply exactly as you would against Hard: centre if it took a corner or an edge, a corner if it took the centre. That keeps your losses at zero and still wins three games in five.
Why it always draws
No amount of cleverness beats Hard, and the reason is size. The board has eight lines. The centre sits on four of them, each corner on three, each edge on two, which is why the centre and corners are where forks are born and why the centre is the usual answer to a corner. But the real proof is brute force: there are only 255,168 possible games of tic-tac-toe (we counted them with the same rules the site uses), and a computer can check every one. The Hard bot does exactly that on every move. A fork only works if your opponent cannot see it coming, and Hard sees all of them.
So when you play Hard, play for the draw and treat a draw as a pass. When you play Easy, play for the fork.
Practice
Switch to Easy and play ten rounds. The opener alternates, so you start five of them: open each in the top-left corner, count how often the bot answers anywhere but the centre, and each time find the fork before you look at the second diagram again. In the five rounds the bot opens, answer a corner with the centre. Then switch to Hard and hold the draw from both sides.
Against Hard, the centre is your shield; against Easy, the corner is your bait.