MazeFinder
A genetic algorithm evolves a route from the top-left corner to the bottom-right of a walled maze. It's MazeFinder's C++ code, compiled to WebAssembly.
- Generation
- 0
- Best fitness
- —
- Optimal route
- —
- Best route
- —
- Seed
- —
Best fitness per generation (lower is better).
How it works
- Mazes are generated in the C++ core from a size and a seed, so a link replays the same maze and the same run. 40 × 40 comes with loops only: one-route mazes that size can need over 400 moves.
- Each genome is a list of moves. A walk starts top-left; a move into a wall is blocked and the walk goes on, stopping at the goal.
- Fitness is the breadth-first-search distance left to the goal, plus the moves used, so a route that arrives keeps getting shorter.
- Each generation keeps the better half of 100 genomes and refills it by crossover and one mutation: a replaced, deleted or inserted move.
- One seeded generator drives it, so a seed replays the same run here and in the native build.
- Thread pool: native build only. The browser scores fitness on one thread.
- 20×20 to 40×40 mazes
- C++ → WebAssembly
- Seeded, reproducible