Skip to content
🃏 Classic1952A.S. Douglas, University of CambridgeEASY

Tic-Tac-Toe rebuild deck

EASY

Nothing is hard; the only thing anyone gets wrong is forgetting to weight minimax by depth, which makes the engine dawdle into wins it could have taken immediately.

You will get essentially the whole thing.

The canonical first minimax exercise, and the canonical first minimax bug is a search that returns the right answer with no sense of urgency. You will watch the computer decline an immediate win because a longer one scores identically, and it reads as a broken search when it is really a scoring omission. Past that, the interesting problem is making the thing not feel like coursework: a stroked winning line and a small squash on placement buy more than another five hundred lines of engine.

Difficulty
EASY · 1 of 5
First playable
An evening
The original
1 team-years
Released
1952 · Classic
Genre
Abstract Strategy
The one-shot build prompt
Build a three-in-a-row grid game with an unbeatable computer opponent, as a single self-contained HTML file. DOM and CSS grid are fine, no canvas needed. No build step, no dependencies.

Requirements:
- 3x3 board, click to place, computer replies. Player chooses who moves first.
- The load-bearing detail: the minimax search must be weighted by depth. Score a win as (10 - depth) and a loss as (depth - 10), never a flat plus or minus ten. Without the weighting the engine still never loses, but it dawdles: it will choose a win in three moves over a win in one, and it will hand you draws that look like charity. Two characters of arithmetic, and it is the difference between an opponent that feels deliberate and one that feels broken.
- Full search, no alpha-beta, no opening book, no memoisation. The complete tree is 549,946 nodes, which is nothing.
- Three difficulties driven by a single number: the probability of playing a random legal move instead of the search result. 0.45 easy, 0.15 medium, 0 impossible.
- The eight winning lines as an array of index triples in a data block, not eight chained conditionals.
- On a win, stroke a line through the winning triple over 250 ms with ease-out. Draws just desaturate the board.
- Running tally of wins, losses and draws in localStorage.

Definition of done: I cannot win on impossible whatever square I open with, and when the computer has a forced win it always takes the shortest one available.
What you lose
  • Nothing at all. There is no ownable thing anywhere in this game
  • The novelty of a machine that cannot be beaten, which stopped being impressive in about 1953
  • Any reason for two adults to keep playing after the second consecutive draw
What to steal

Canonical form: collapse the eight board symmetries

The eight symmetries of a square fold most of a board game's opening tree into a fraction of itself, and the same canonicalisation habit dedupes procedural rooms, tile sets and generated puzzle banks. The transferable part is not the saving, it is the discipline of keying state by canonical form and remembering to invert the transform on the way back out.

ScopeAn evening— build just this, not the game

Build a state-space explorer for a small square board. Single self-contained HTML file, DOM only, no dependencies, no build step.

- A 3x3 board and a full game-tree walk from empty.
- Canonical form: generate the eight transforms of a position under the symmetries of a square, four rotations and their mirrors, encode each as a string, and take the lexicographically smallest as the position's key. Memoise search results against that key.
- The part everyone gets wrong: a move found for the canonical form is expressed in canonical coordinates. Apply the inverse transform before playing it, and assert on the result rather than trusting it.
- Report raw nodes visited, canonical nodes visited, cache hits and the ratio, side by side.
- A board editor plus a strip showing all eight transforms of the current position with the canonical one highlighted.

Definition of done: canonical enumeration visits roughly an eighth of the raw node count, and the engine returns the same move, correctly rotated back, for all eight orientations of one position.
Make it different

Not a clone — Tic-Tac-Toe re-themed and cut down to something you can finish. The angle is the important reel: it is what turns a project into a weekend. 24,360 ways to land.

The Outfit One Room

Tic-Tac-Toe, but one level, done properly, set in organized crime. Rendered in black-and-white noir film.

Themeorganized crime
Angleone level, done properly
Lookblack-and-white noir film
Build a browser game called "The Outfit One Room".

The pitch in one line: a abstract strategy in the spirit of Tic-Tac-Toe, but one level, done properly, set in organized crime.

WHAT THIS IS
Take the SHAPE of Tic-Tac-Toe — its core loop, and whatever makes that loop good — and rebuild it as your own game in a different world at a smaller scope. Use your own names, art and audio, which you want anyway: a reskin of somebody else's game is less interesting than a new one that works the same way.

THE ANGLE — this is the important constraint, honour it above everything else
One level, done properly. A single space, built to a finish quality you could not sustain across twenty. Every prop and every sightline is deliberate.
This is what makes the project finishable. If a decision would push the scope back towards the original's, take the smaller option every time.

THE THEME
Organized crime. Families, territory and quiet threats. The win condition is control, not a body count.
The theme is not a coat of paint. Let it change what the mechanics mean — a reload, a health pack and a locked door should all be things that make sense in this world and nowhere else.

LOOK
Black-and-white noir film. High-contrast monochrome, venetian-blind shadows, film grain, and practical hard lights only.

REQUIREMENTS
- Runs in a browser with no build step. Canvas 2D unless the angle genuinely requires 3D, in which case three.js.
- Fixed-timestep update loop with interpolated rendering, so it behaves the same at 60Hz and 144Hz.
- Every tuning constant in one CONFIG object at the top, exposed as live sliders in a debug panel. You will find the feel by dragging those, not by prompting.
- All content — levels, entities, balance numbers — in JSON or plain data files, never inline in the logic.
- Audio generated with the Web Audio API rather than asset files.
- Respect prefers-reduced-motion: keep the fades, drop the shake and the parallax.

BUILD ORDER
1. The core loop with placeholder rectangles, at the reduced scope the angle demands. No theme, no art, no audio. Make it fun as rectangles first.
2. The angle's consequences. Cutting to bots, or to turn-based, or to one level changes the design rather than just shrinking it — find out how and rewrite step 1.
3. The theme, as content and data.
4. The look, applied last as a rendering layer over a game that already works.

Start by writing a one-page plan: the core loop, what the angle removes and what that frees you to do properly, and what you are deliberately leaving out. Wait for me to approve it before writing code.
Prior art — read before you build

Half the time one of these already does what you wanted, and the other half it saves you a week of solving a problem someone documented in 1997.

Did you build it?
0Share on X

One count per game. No account — it is tied to a salted hash of your IP, which is not stored in a form anyone can reverse. Every build adds 1 team-years to the counter on the homepage.

Questions

How hard is Tic-Tac-Toe to rebuild with an AI agent?

Yes — every game is buildable at some scope. The question is how hard, and Tic-Tac-Toe is EASY (1 of 5). You will get essentially the whole thing. Nothing is hard; the only thing anyone gets wrong is forgetting to weight minimax by depth, which makes the engine dawdle into wins it could have taken immediately. Reckon on an evening to something you can actually play — not to something that matches the 1 team-years A.S. Douglas, University of Cambridge spent.

What makes Tic-Tac-Toe hard to rebuild?

Nothing is hard; the only thing anyone gets wrong is forgetting to weight minimax by depth, which makes the engine dawdle into wins it could have taken immediately. That is why it sits at EASY rather than a tier either side of it. If you want the idea without the project, the transferable part is canonical form: collapse the eight board symmetries — an evening of work.

How long does it take to build a Tic-Tac-Toe clone?

Wrong question, and it is worth saying why. Nobody rebuilds Tic-Tac-Toe — the original took A.S. Douglas, University of Cambridge on the order of 1 team-years, released in 1952 on Classic. What you can do is reach something playable and genuinely yours in about an evening, and then keep going for as long as it stays interesting. Any figure that claims otherwise is measuring a prototype and calling it a game.

What do I lose by building my own Tic-Tac-Toe?

Nothing at all. There is no ownable thing anywhere in this game. The novelty of a machine that cannot be beaten, which stopped being impressive in about 1953. Any reason for two adults to keep playing after the second consecutive draw. Those are the parts a prompt will not hand you.

Which AI coding agent should I use to build it?

Any of Claude Code, Codex or Cursor will handle this prompt. Paste it as your first message, let the agent scaffold the project, then iterate on feel — the second, third and tenth prompts are where a game actually gets good. Work in an empty folder or a fresh git branch so you can throw it away cheaply.

Get the next game

One email when new games go on the list. No other reason to email you, ever.