How to beat the computer at Tic Tac Toe: Easy, Medium and Hard
Each difficulty level in TicTacToe follows a different set of rules. Once you know the rules, you know exactly how to beat it, or in the case of Hard, why you can't.
The computer opponent in the TicTacToe app has three levels. They aren't the same player with different reaction times. Each one follows its own rules, and each rule set has its own weak spots. Below is how each level thinks, the best winning chance you can get against it, and how to get there.
The percentages come from a full analysis of the game against each level's actual decision rules, assuming you play the best possible moves.
| Level | How it plays | Your best chance to win, moving first | Moving second |
|---|---|---|---|
| Easy | Picks a random empty square | 99.5% | 93.9% |
| Medium | Takes wins, blocks threats, likes the centre and corners | 82.3% | 10.0% |
| Hard | Searches every possible game | 0% | 0% |
Easy: plays at random
Easy chooses uniformly among the empty squares. It doesn't look for wins and doesn't block. It can still beat you by accident if you leave a line open for long enough, but any plan at all will beat it nearly every time.
How to win: take the centre or a corner, then build towards a fork. Because Easy doesn't block, even a single threat usually wins. If you're helping a child learn the game, Easy is the right place to start: they'll win often and learn what three in a row looks like. Read more in Tic Tac Toe for kids.
Medium: blocks and takes wins
Medium follows a short list on every move:
- If it can complete a line, it does.
- Otherwise, if you can complete a line, it blocks.
- Otherwise it takes the centre half of the time when it's free, then leans towards corners, and otherwise plays anywhere.
Medium never misses a win or a single threat, so one-line attacks won't work. But it doesn't look more than one move ahead, which means it can't see a fork coming. And because step 3 is partly random, it often answers your opening with the wrong square.
The plan when you move first
- Open in a corner. Medium only takes the centre a little over half the time. Every other reply loses by force: take a second corner, make a threat, and fork. The patterns are in forks and traps.
- If Medium does take the centre, play the opposite corner. Now Medium needs to find an edge, but it prefers corners, and two thirds of the time it plays one. Then your forced block becomes a fork.
With this plan you win about 82% of the games where you move first. Opening in the centre, by comparison, gives you only 50%, because Medium's favourite reply (a corner) is exactly the right defence. See the best first move for the full comparison.
When Medium moves first
The app alternates who starts each round, so half your games begin with Medium's move. It usually opens in the centre or a corner, which are strong, and you only get winning chances when it starts somewhere weaker or misplays later. Your realistic goal here is to never lose: take a corner against a centre opening and the centre against a corner opening, and follow the never-lose rules.
Hard: never loses
Hard plays perfectly. On every move it looks at every possible continuation of the game, all the way to the end, using an algorithm called minimax. It picks a move that gives the best guaranteed result. If it can win, it takes the quickest win. If you've played perfectly, it settles for a draw. We explain the method in how a computer plays perfect Tic Tac Toe.
A few details make it less predictable than you might expect:
- When it moves first, it opens at random in the centre or one of the four corners. All of them are equally good, so there's no point always playing the same one.
- When several moves are equally good, it picks one of them at random. You'll see different games even though it never makes a mistake.
You cannot beat Hard. Tic Tac Toe is a draw with perfect play, so the best possible result is a draw. That makes Hard a great test: if you can draw it every single game, moving first and second, your Tic Tac Toe is flawless.
Common ways to lose to Hard: answering its corner opening with anything other than the centre, answering its centre opening with an edge, and grabbing a corner in the "corner, centre, opposite corner" position instead of an edge.
A training plan
- Easy: learn to spot three in a row and set up forks.
- Medium: learn to win against a player who blocks. Aim to win at least three out of four games when you start.
- Hard: learn to never lose. Aim for ten draws in a row.
The scoreboard in the app keeps separate counts for each mode and difficulty, so you can track your progress at each level. You can reset it from Settings whenever you want a fresh start.