Eigensoul LabNo. 097 / 100Toys
Watch one full cycle of carve, flood and solve. Restart for a new maze.

Toys · Study 097

Minotaur's Homework

Watch a perfect maze being carved by depth-first search, then flooded by a breadth-first solver that finds the shortest route corner to corner.

What you're looking at

The carver starts in one corner, walks to a random unvisited neighbour, knocks down the wall between them, and backs up only when stuck. That guarantees exactly one route between any two cells. The solver then spreads outward from the start one step at a time, tinting each cell by its distance, until it reaches the far corner and the red path is traced back.

The idea behind it

Depth-first carving makes long winding corridors with few branches, which look hard and are in fact easy to solve. Breadth-first search is the opposite kind of walk: it explores every route at once, so the first time it touches the exit it has found the shortest way there.

Try this

Watch one full cycle of carve, flood and solve. Restart for a new maze.

  • maze generation
  • depth-first search
  • breadth-first search
  • pathfinding
  • algorithm