Maze generation algorithms
https://editor.p5js.org/asymptoticSystemKey/full/FJk1OWjNb
Best viewed on desktop in Chrome.
An interactive p5.js lab for exploring maze generation algorithms through their behavior and output.
Switch between algorithms and watch how each one builds structure in real time.
Same grid. Same constraints. Different rules.
mazeASK is an expression of intent on three layers >>
- artistic purpose: docs/intent/artistic-purpose.md
- didactic purpose: docs/intent/didactic-purpose.md
- workflow experiment: docs/intent/workflow-experiment.md
mazeASK.js is structured as a single p5.js sketch with three phases >> initialization, incremental generation, and rendering. The step...() functions contain the algorithm-specific generation logic.
For the conceptual generalization path from rectangular mazes to topology-owned structure, see docs/didactic/generalization-narrative.md.
- Recursive Backtracker
- Binary Tree
- Prim
- Sidewinder
- Eller
- Kruskal
- Wilson
- Aldous–Broder
See docs/didactic/algorithm-notes.md for a breakdown of each algorithm and what it produces.
All of these are doing the same thing >>
building a spanning tree.
What changes is how the next connection is chosen.
That choice introduces bias.
That bias shapes the structure.
That structure is what you see.
1Recursive Backtracker2Binary Tree3Prim4Sidewinder5Eller6Kruskal7Wilson8Aldous–Broder
clicksave PNG outputetoggle start + finish overlaystoggle solution path overlayspaceregeneraterrecolorhtoggle rectangular / hex topologyctoggle rectangular / radial topologyttoggle rectangular / triangle topology-/+adjust speed
[decrease grid]increase grid
otoggle output modepcycle square /4:3/ widescreen
Rectangular is the default baseline.
Hex is opt-in through the H toggle and currently works for >>
- Recursive Backtracker
- Binary Tree
- Prim
- Aldous–Broder
- Wilson
- Kruskal
Radial is opt-in through the C toggle and currently works for >>
- Recursive Backtracker
- Binary Tree
- Prim
- Aldous–Broder
- Wilson
- Kruskal
Radial does not yet claim support for >>
- Sidewinder
- Eller
Triangle is opt-in through the T toggle and currently works for >>
- Recursive Backtracker
- Binary Tree
- Prim
- Aldous–Broder
- Wilson
- Kruskal
Sidewinder and Eller remain rectangular-only for now.
Copyright 2026 Andrew S Klug // ASK
Licensed under the Apache License 2.0 // see LICENSE
