Arcade · Game + AI demo
Tetris AI
Play a full game of Tetris yourself — or flip to Watch AI Learn and see a transparent AI score every possible move, then improve across generations. The scoring function is on screen. Nothing is hidden.
Choose your mode
The AI mode is a heuristic demo, not real ML training. Real systems train on millions of games; this shows the idea: try options, score them, keep what works.
Ready. Use the buttons or your keyboard.
- ← → move · ↓ soft drop · ↑ rotate · Space hard drop · P pause
The AI's brain Simplified educational demo
For every falling piece the AI tries every rotation × every column, simulates the landing, and scores the result with this formula. Watch the top-3 ghosts on the board, then see the winner flash and lock.
score = lines × wlines − (height × wagg + holes × wholes + bump × wbump). You can tweak the weights live; the next piece uses them.
Top-3 candidate moves
Live scores for the current piece. Highest score wins.
- –waiting for the demo to start…
Generations
Every 25 pieces is one generation. Then the 4 weights are randomly nudged ±10%; the new set is kept only if that generation's score beat the best — otherwise it reverts. This mutate-and-keep loop is the whole "learning".
Tune it
Settings
Difficulty sets the starting level and gravity in Play mode. Sound effects can be silenced.
Settings are saved on this device. If the Arcade's shared settings panel is present it stays in sync.
The lesson
What this teaches
Two real ideas from AI research, shown with all the wiring exposed.
1 · AI evaluates options with a scoring function
The AI never "sees" the board the way you do. It lists every legal move — each rotation in each column, at most a few dozen — simulates where the piece would land, and runs a scoring function over the result: reward cleared lines, penalize height, holes, and bumpiness. The highest score wins. That loop — generate options, score, pick best — is the skeleton of search, planning, and decision-making in real systems too.
2 · "Learning" can mean keep-what-works
The AI doesn't know good weights to start. So every 25 pieces it mutates the four weights by ±10% and keeps the new set only if the generation scored better — otherwise it reverts. This is a tiny version of evolutionary search: random variation plus selection pressure. No gradients, no neural network, no millions of games — just try, measure, keep winners, repeat.
3 · The honest part
This is a demo, not training. Real game-playing AI trains on millions of games with far richer state and far more compute; a four-number heuristic would never reach that level. What's real here is the shape of the idea: an explicit scoring function you can read, and an iterative loop that improves by keeping what works. If you can follow this page, you can follow the pitch of much bigger systems.
Simplified educational demo. The AI logic runs entirely in your browser; nothing is sent anywhere, and no real machine-learning model is trained or used.