The Lab · Five playable systems
Arcade
Five games, each built around an algorithm I wanted to implement properly rather than approximate. Every one ships its solver alongside it, with live telemetry so you can watch the search work — and each is honest about whether its AI can actually promise you a win.
-
01
2048
A table-driven engine — all 65,536 row transforms precomputed — under a depth-adaptive expectimax search over chance nodes.
Measured, not guaranteed Expectimax · transposition table -
02
Connect Four
Iterative-deepening negamax with alpha-beta pruning and a Zobrist transposition table. It reports forced wins as proofs, with the move count.
Proves forced wins Negamax · alpha-beta · Zobrist -
03
Snake
A Hamiltonian cycle with guarded shortcuts. This is the one AI here with a real proof: it cannot die, and it fills all 144 cells.
Provably always wins Hamiltonian cycle · invariant -
04
Minesweeper
Constraint propagation, then subset subtraction, then exact enumeration of every consistent mine arrangement to get the true odds.
Deductions are proofs CSP · exact probability -
05
Sudoku
Knuth's Algorithm X with dancing links, plus a generator that re-solves after every removal to guarantee a unique answer.
Solves any valid grid Dancing links · exact cover
On guarantees
| Game | Guarantee | Why |
|---|---|---|
| Snake | always wins |
Deterministic and fully observable. The cycle invariant makes a fatal move unreachable. |
| Sudoku | always solves |
A finite exact-cover search. If a solution exists, Algorithm X finds it. |
| Connect Four | perfect at the horizon |
Solved in theory, but proving it from an empty board is expensive. Inside its search horizon the result is exact. |
| Minesweeper | no |
Hidden information. Some boards reduce to a genuine coin flip; the solver reports the odds instead of bluffing. |
| 2048 | no |
Tiles spawn at random, so for any policy some spawn sequence beats it. Only a measured rate is honest. |
Measured 2048 strength
scripts/benchmark-2048.mjs
- Games sampled
- —
- Reached 2048
- —
- Reached 1024
- —
- Median score
- —
- Mean moves per game
- —
Run npm run test:2048 to reproduce these numbers locally. The benchmark drives the
same engine module the page loads, over seeded games, so a run is reproducible.