Jacob Stevenson

Loading…

How to play

Nine games of tic-tac-toe in one

  1. The board is nine small tic-tac-toe boards in a 3 × 3 grid. X moves first.
  2. Where you play decides where your opponent plays next. Take the top-right square of a small board, and they must play in the top-right board. The board to play is shaded.
  3. Get three in a row on a small board to win it. Win three small boards in a row, across, down, or diagonally, to win the game.
  4. If you send your opponent to a board that’s already won or full, they can play in any open board.
  5. If every board is finished and no one has three in a row, the game is a draw.

Some versions break that tie by counting who won more boards. This one doesn’t: these are the standard rules, the ones the solver works on.

About

How the bot works

Hard and Expert are uttt.ai’s player, by Arkadiusz Nowaczyński: a neural network trained AlphaZero-style on millions of positions from self-play, guiding a tree search. Expert searches 1,000 positions a move, as uttt.ai does on a computer, and Hard 200; on a slow phone they search fewer, so a move never takes more than a few seconds. Easy and Medium are ultimattt, Nelson Elhage’s engine, looking one or three moves ahead. It all runs on your device, compiled to WebAssembly, and your moves never leave it. The network is a 10 MB download, fetched the first time you play Hard or Expert or open the analysis.

From move 30, Hard and Expert also run ultimattt’s solver before each move. Once it proves the position won or drawn, the bot plays a move that keeps that result, so from there it plays perfectly.

The analysis board runs the same search and marks each move by how much it gives up against the search’s choice. From about move 28, it also runs the solver, which proves the result with perfect play from both sides, a fact rather than an estimate. Once the solver settles a position, it marks each move as one that wins, draws, or loses.

The story

No one knows yet whether X can force a win in ultimate tic-tac-toe. A variant with a stricter rule was solved in 2020 (the first player wins), but the standard game is open. I set out to see how far a solver could get, starting from Nelson Elhage’s and his write-up at minimax.dev.

The first job was trust. I checked each of the solver’s shortcuts against brute-force search and corrected two endgame rules, tested on a million random positions, and the solver now agrees with brute force on 2,553 random late positions. Then speed: a small neural network, trained on positions the solver had settled, tells it which moves to try first, and on hard positions it cuts the search to about a third.

The whole game is still a long way off. Elhage estimated a full solve at a few hundred million CPU-hours, which is about 700 years on my 16-core machine. The search has to shrink a thousandfold before pooling volunteers’ computers makes sense, so that’s the work now. The code is on GitHub.

Credits

  • The rules, Easy and Medium, and the solver: ultimattt by Nelson Elhage, under the Apache License 2.0, with my changes marked in each file.
  • Hard, Expert, the analysis, and the layout: uttt.ai by Arkadiusz Nowaczyński, under the Apache License 2.0. Its network and search run here in my Rust port, checked against the original.
  • The type: Newsreader and Hanken Grotesk, under the SIL Open Font License.
  • The license texts: licenses.txt.