🌀 Maze Generator

Every perfect maze is a spanning tree of the cell grid — exactly one path exists between any two cells. Four generation algorithms produce trees with very different "feel": DFS (Recursive Backtracker) gives long winding corridors with few dead-ends; Prim's grows outward like a crystal with many short branches; Wilson's (loop-erased random walk) produces uniformly random spanning trees with no bias; Kruskal's shuffles all walls and removes them if they join different sets. After generation hit Solve (BFS) to highlight the shortest path. 🇺🇦 Українська

Algorithm

Cells
Visited
Path length
StatusReady

Algorithm Comparison

All four produce perfect mazes (spanning trees), but from different probability distributions. DFS overweights long straight passages (biased). Prim's produces mazes with many short dead-ends (mildly biased). Kruskal's is close to uniform on edges. Wilson's algorithm is exactly uniform over all spanning trees — provably unbiased — but can be slow when few cells remain unvisited.