MakarovSuites
English
EnglishDeutschРусскийУкраїнськаFrançaisEspañolItalianoPolski
Contact & licences

Math

Mazes: generate and solve

Generate mazes with depth-first carving, Prim and Wilson, then compare breadth-first, A* and wall-following routes.

Mazes: generate and solve — Actual application image
Actual application image

Try this

Generate a perfect maze, then reveal the search and route. Click a cell to choose the goal. Wilson uses loop-erased random walks; all three generators produce spanning trees. Wall following counts revisits and may take a longer route.

Equations used in the module
Equations
A perfect maze is a spanning tree: V vertices and V−1 passages
BFS finds a shortest path in an unweighted graph
A*: priority = distance so far + Manhattan lower bound
Wilson samples a uniform spanning tree using loop-erased random walks

Related experiments

Back to catalogue