← Ultimate tic-tac-toe against the computer

Ultimate Tic-Tac-Toe Strategy: Where Your Move Sends the Computer

The numbers on this page come from games simulated with the page's own code: the rules and the computer's Monte Carlo search, copied unchanged. The levels are limited by time, so they were simulated at a fixed number of random games per move — 5,000 for Normal, 18,000 for Hard, 50,000 for Expert, about what each level manages from the opening on our test machine. Each figure gives the number of games behind it.
The short answer

In ultimate tic-tac-toe the cell you choose matters less than the board it sends your opponent to, and the board worth fighting for is the centre one: between two equal copies of the computer, whoever won the centre board won the game 60% of the time, against 44% for an edge board. Simple safety rules are not enough against this computer — never letting it win a small board on the next move won just 3% of 200 games against Normal — while a player who looks as far ahead as Normal wins about half. No level repeats itself, so there is no fixed winning line to learn.

Every move is an address

Number the cells of a small board 1 to 9, left to right and top to bottom, and number the nine small boards the same way. A move in cell 3 of any board sends your opponent to board 3, the top-right one. So each move has two meanings: where your mark goes, and where the computer's next mark must go.

Cell numbers inside any small board. The number of the cell you play is the number of the board your opponent must play in next.
A small board where the computer (O) has two in a row. Any move of yours in a cell with the same number as this board sends it here, and it completes the row at 1.

This is the first thing to check, and the simulations show how much it costs to ignore. A player who simply takes a small board whenever it can and otherwise plays at random lost 199 of 200 games against Normal, and the games were short: 34.5 moves on average, counting both sides. Adding one check — never send the computer to a board it can win on the spot — stretched the games to 46 moves and brought the first wins and draws: 6 wins and 8 draws in 200.

Winning small boards is not the same as winning the game. That careful player took the first small board in 185 of its 200 games and still lost 186 of them; at the end the computer held 4.2 boards on average, the human 2.9. The computer gives up a board readily when doing so sends you somewhere useless and leaves it the next address it wants. The page's own article says the same in theory; here it is in numbers.

What the centre is worth, measured

The big board is a tic-tac-toe board, so the same count applies: the centre board lies on four of the eight winning lines, each corner board on three, each edge board on two. The simulations agree, whichever way the question is asked:

MeasureCentre boardCorner boardEdge board
Winning lines through it (exact)432
X wins after a first move there, random play*43–45%42%40%
Decided (won by someone), computer vs computer88%78%66%
Its owner won the game, computer vs computer60%49%44%

* Both sides play random legal moves to the end, 40,000 games for each kind of first move. Overall, random play gives X 41.3%, O 36.6% and a draw 22.1% (100,000 games). “Computer vs computer” is 200 games of Normal against Normal.

The computer's own search, given far more time than any level — a million random games — spends 11% of them on the centre cell of the centre board, two and a half times as many as on any other first move, and scores it at 56% for the player who moves first (a draw counting as half a win).

One trap: the centre cell is not the centre board. A move in cell 5 sends your opponent to board 5. A rule that preferred the centre board and, inside any board, the centre cell handed the centre board to the computer in 187 of 200 games against Normal. Fight for board 5 by playing in it, and be careful about how often you send the computer there.

The send-back opening, and why it fails here

A well-known opening tries to exploit the send rule: take the centre cell of the centre board, and every time your opponent has to answer there, reply with the centre cell of the board he sends you to. That sends him straight back to board 5, again and again, while you collect centre cells all over the big board.

Against this computer it backfires at once. Your mark in board 5 sits alone, and the computer gets to place mark after mark there for free.

The centre board in a real game against Normal after five moves of the send-back opening: X opened in its centre, O has two marks down the left column. Sent back once more, O completes the column at 1.

In 200 games against Normal the computer won the centre board in all 200, typically with its third move. From then on, every centre-cell move sends it to a closed board and gives it a free move. The opening won 4 of the 200 games, no better than the plain safety rule.

Free moves: how this page handles a closed board

A small board closes when someone wins it or when it fills up with no winner. Its empty cells are out of play for good (they turn grey), and a full board with no winner counts for nobody. If your move points at a closed board, your opponent may play in any open board; when that happens to you, the page lights up every open board.

One case is easy to miss: the board you have just closed counts. Win the top-right board with its top-right cell, and your move points at that same board, now closed — a free move for the computer.

X completes the top row of the top-right board with its top-right cell (ringed). The board closes, and because the move points at board 3 itself, the computer may play in any open board.

Free moves are part of almost every game. In random play 99.4% of games had at least one, 7.5 per game on average, the first usually after about 36 moves. Between two equal copies of the computer each side got about three per game, and the side that got more of them won 88% of those games when it was X and 68% when it was O. That is a link, not proof that the free move itself decides the game: free moves appear when boards close, and the side that closes them is often already winning.

Avoiding them is not a strategy by itself. Adding “never give a free move when you can avoid it” to the safety rule changed little against Normal: 1 win and 17 draws in 200 games, against 6 wins and 8 draws without it. The difference is within chance at that sample size.

How each level plays, and what beats it

All three levels run the same Monte Carlo search; the only difference is how many random games it plays out before the clock stops it. Here is how simple ways of choosing a move did against each level (you play X and move first; ties broken at random):

Your rulevs Normalvs Hardvs Expert
A random legal move0% (200)––
Take a small board whenever you can, otherwise random0% (200)––
Never let the computer win a small board next move; otherwise take boards3% (200)0% (60)0% (30)
The same, and never give a free move0.5% (200)–0% (30)
The same, and prefer the centre board and centre cells2% (200)0% (60)–
The send-back opening, then the safety rule2% (200)––
The page's own search, 1,000 random games a move8% (100)––
The page's own search, 5,000 random games a move (as much as Normal)51% (200)7% (60)7% (30)
The page's own search, 18,000 random games a move (as much as Hard)68% (60)33% (40)–

Wins for you; the number of games in brackets. A dash means not simulated. Draws are not counted as wins: the safety rule drew 4% of games against Normal, the search with 5,000 games drew 18.5% against Normal, 23% against Hard and 20% against Expert.

The table says something plain: against this computer, rules of thumb about single moves are worth almost nothing, and looking further ahead is worth everything. A search as deep as Normal wins half its games against Normal, and that is with the first-move advantage — the computer answering itself as O won only 30.5% of those games. Give the search five times less and it wins 8%; give it as much as Hard, and it beats Normal in 68% of 60 games. Against Hard itself, that equal search won 13 of 40 games, lost 13 and drew 14: the deeper both sides look, the more often the game ends level.

No level repeats itself. The search picks which line to try next and plays out every game with random moves, so the same position gets different answers. After your centre opening, 200 searches at Normal's budget produced all eight possible replies, the most common one only 21% of the time; at Expert's budget 40 searches produced seven different replies. A fixed list of moves that beats it once will meet a different game next time, so this guide has no recipe to learn by heart.

Your device matters. The level sets a thinking time, not a strength. The line under the board shows how many random games the computer finished for its last move; on a fast computer that number, and the level, are higher than in our simulation, on an old phone lower.

The rules of thumb, in order of value

  1. Before every move, look at the board it sends the computer to. If it can win that board at once, play somewhere else, even at the cost of a board of your own.
  2. Win the game, not boards. Three small boards in a line decide it; boards off your lines are worth little, and the computer gives them away on purpose.
  3. Fight for the centre board by playing in it, and count how often your moves send the computer there.
  4. Before you close a board, check what your move points at: winning a board can hand the computer a free move.
  5. Look two moves ahead, not one: where you send it, and where its best answer sends you back.

The first rule alone moved the result against Normal from 0 wins to 6 in 200; everything else on this page is about the fifth, because that is the difference between 8% and 51%.

Questions and answers

What is the best strategy in ultimate tic-tac-toe?

Think about where each move sends your opponent before you think about the cell itself: never send them to a board they can win at once, fight for the centre board, and play for three boards in a line rather than for as many boards as possible. Against the computer here, looking two moves ahead matters far more than any fixed rule.

What happens if you are sent to a board that is already won?

On this page you may play in any open board: a board that has been won, or filled with no winner, is closed for good. That includes the board just closed by the move that sent you there.

Is it better to go first in ultimate tic-tac-toe?

Yes, by every measure we took. In 200 games between two equal copies of this computer, the first player won 51% and the second 30.5%, with 18.5% drawn; even in purely random play the first player wins 41% against 37%. The game has not been solved, so this is an observation, not a proof.

Is the centre the best first move?

The centre cell of the centre board is the computer's own favourite: with a million random games to think, it spends more time on that move than on any other and rates it at 56% for the first player. In random play, a first move in the centre board gives X 43–45%, against about 40% for an edge board.

Can you beat the computer at ultimate tic-tac-toe?

Yes, but not with simple rules: the best of them won 3% of 200 games against Normal in our simulation. What wins is calculation: a player who looks as far ahead as Normal beats it about half the time. Hard and Expert simply look further.

Does the computer always play the same way?

No. All three levels choose moves from thousands of random playouts, so the same position gets different answers: after the centre opening, Normal chose among all eight possible replies across 200 searches. There is no fixed sequence of moves that always wins.

Play ultimate tic-tac-toe against the computer →
Where to go from here
To cite this page: “Ultimate Tic-Tac-Toe Strategy: Where Your Move Sends the Computer”, You vs Computer, https://youvscomputer.com/games/ultimate-ttt-strategy.html