Skip to main content
This is the project I reach for when someone asks what I like to build. It’s an escape room that a genetic algorithm learns to solve — no hard-coded solution, just evolution stumbling its way to the exit.

The idea

A genetic algorithm treats each attempt to escape as an individual in a population. Each one has a “genome” — a sequence of moves. The ones that get closer to the exit are scored higher, the best are combined and mutated, and over many generations the population converges on a route that works. Nobody tells it the answer; it finds it.

What makes it fun

  • You can watch it learn. Early generations flail around uselessly. Later ones move with something that looks unnervingly like intent.
  • The fitness function is everything. How you reward “progress” completely changes what the algorithm discovers — including the clever, cheating solutions you didn’t intend.
  • It’s all in the browser. Built with JavaScript, CSS and HTML, so it runs anywhere with no setup.

Source on GitHub

miltonials/scape-room
Genetic algorithms are one of those ideas that sound abstract until you watch one work. This was my way of making it concrete — for myself first, and then for anyone I could show the video to.