Home▸Algorithms & AI▸Recursive Backtracking Maze Generator (2D)

🧩 Recursive Backtracking Maze Generator (2D)

A 2D Canvas maze generator: watch four classical algorithms (Recursive Backtracker, Prim's, Kruskal's, Wilson's loop-erased random walk) carve a perfect maze, then solve it instantly with breadth-first search.

Algorithms & AI2DEasy60 FPS📱 Mobile-adapted⇄ 3D version
2d-maze ↗ Open standalone
⚙ Under the hood

A 2D Canvas maze generator that carves a perfect maze on a square grid using one of four selectable algorithms: Recursive Backtracker, Prim's, Kruskal's, or Wilson's loop-erased random walk. Switch algorithm or grid size at any time and watch the carving animate live, then run a breadth-first search to instantly highlight the shortest path from start to finish.

Maze GenerationGraph AlgorithmsPathfindingSpanning TreeBFSCanvas2D

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)