IS
All experiments
live

AI Tetris — evolving a strategy

Tetris played by an evolving agent. It scores the board by features — height, holes, bumpiness — and evolution tunes their weights on its own.

lab note
Why I built it

Tetris is about long-term strategy, not reflexes. I was curious whether evolution could handle that kind of multi-move planning — and what board representation it needs to do it.

What I learned

What decides here isn’t a deep network but the board features: aggregate height, number of holes, surface bumpiness, cleared lines. Evolution tunes the weights of these heuristics — essentially rediscovering something close to Pierre Dellacherie’s classic agent.

Where it broke

Naively brute-forcing every rotation × position to score a move stalled the rendering. I rewrote the scoring into a single pass over the board and limited how far ahead the agent looks — and it went smooth.

Stack
Canvas 2DNeuroevolutionVanilla JS

Strategy, not reaction

Unlike the dino and the snake, this agent doesn’t react to a frame — it evaluates the future board: for every possible move it computes a set of features and picks the best one. Evolution tunes how harshly to penalize holes and height relative to cleared lines.

live demo· sandbox
Loading demo…

The simulation is isolated in a sandbox iframe, like the rest of the lab’s AI experiments.