Skip to content
All builds

GridlockBrowser Game + AI

What it does for you

Two classic games with local search AI, hints, undo and a window into the next move.

Gridlock screenshot

Screenshots

Gridlock screenshot 1

In more detail

Gridlock is a small game room where you play Connect 4 or Tic-tac-toe against a computer opponent and can peek at how it's thinking. There are four difficulty levels, a two-player mode on one device, hints, undo, move history, and save and open. The opponent runs locally in the browser, no AI service involved.

Honest limits

Nothing was deployed and no API was called. Browser checks covered a real worker reply, undo, hints, a local Tic-tac-toe win, and no overflow at 390 pixels wide, but play was checked by scripts, not by people. The folder still holds an unused Ultimate Tic-tac-toe module that hasn't been validated. There's no text-based board summary for screen readers yet.

How I built it

Gridlock sat at the top of the Codex list in 00-system/capstone-split.md, and Codex worked that list top to bottom. The engine already existed in the folder from an earlier interrupted session. Codex reviewed it, kept it after testing, added independent tests, and built the UI, the Web Worker integration, the local server, and the screenshots. About 0.2 hours this session, with the earlier engine work not counted. No subagents were used.

I set the scope, the ownership boundary, and asked for a polished local build. Codex left the central tracker and shared learning logs alone and wrote its LOG-ENTRY.json in the project folder for Claude Code to merge.

Under the hood, Connect 4 stores its 49-bit board as two split integers instead of BigInt. The search is alpha-beta with iterative deepening and a transposition table, and it runs in a Web Worker so the board stays responsive while the opponent thinks. The worker imports the same engine module the tests do. Expert Tic-tac-toe uses exact memoized minimax.

What I learned

  • A second representation catches bitboard mistakes. The tests play 100 seeded legal games and compare them move by move against a separate plain grid implementation.
  • A worker reply needs an identity, not just a move. Request IDs plus resetting the worker stop an old search result from playing into a new game after undo or reset.
  • "Unbeatable" is testable for Tic-tac-toe. The suite branches through every opponent reply against the Expert strategy, from both sides, and it never loses.
  • A board can be correct and still too big. Looking at the screenshots led to a narrower board, and to keeping pieces visible in full columns instead of dimming them.
  • Independent state models and browser tests catch different kinds of failure. You want both.

What carried forward

Gridlock kept an existing, tested engine instead of rewriting it, which is the reuse the split file asked for. It uses the shared house rules (tested pure module, serve.mjs on 5160, ?demo=1, dark and light themes). No later project imports its code.

If I took it further

Add move-by-move replay and an accessible text summary of the board, and either remove the unused Ultimate module or test it properly before exposing a third game.

#060 Built with Codex September 23, 2026 180 automated checks

Want one like this?