A single-file, offline maze generator that makes balanced mazes with an embarrassingly obvious way out.
Most maze generators hide the solution behind a tangle of dead ends. Stupid Mazes does the opposite: it generates a proper, balanced maze but guarantees a trivially obvious direct path from the start to the exit — either a few big steps through the middle or hugging the border edge (about 50/50 which one you get). The middle route never backtracks: every step heads toward the exit (e.g. only ever right or down for a top-left → bottom-right maze). The rest of the maze is real; the way out is just... stupid.
Everything lives in one HTML file. No build step, no dependencies, no network access. Open stupid-mazes.html in any modern browser and go.
Features
- Stupid mode (on by default) — carves a guaranteed obvious start-to-exit route, then generates a genuine maze around it so that route stays the unique solution. Toggle it off for a normal maze.
- Balanced generation only. No recursive backtracker or other algorithms that produce long, snaking, lopsided corridors. Choose from four balanced/uniform generators:
- Randomized Prim's
- Randomized Kruskal's
- Aldous-Broder (uniform spanning tree)
- Wilson's (uniform spanning tree) — default
- Configurable start/exit placement:
- Opposite corners
- Top-middle ↔ bottom-middle
- Random (openings are never placed confusingly adjacent to each other)
- Reproducible seeds. Supply a seed for a deterministic maze, or leave it blank to get a fresh random one each time (the seed used is always shown below the maze). Uses a custom seeded PRNG so results are identical everywhere, offline.
- Show Solution — optional overlay of the direct path, with configurable thickness and color.
- Fully customizable rendering: maze width/height (in cells), cell size (px), wall width (px), wall color, and background color.
- Export to PNG, WebP, and SVG. Exports match exactly what's on screen (including the solution overlay if shown). Filenames encode the dimensions and algorithm, e.g.
stupid-maze-20x20-wilsons-demo.svg.
Usage
- Download
stupid-mazes.html. - Open it in your browser (double-click it, or
File → Open). - Click Generate for a new maze. Open Options to change size, colors, seed, placement, algorithm, and the solution overlay.
- Use the PNG / WebP / SVG buttons to save an image.
That's it — it runs entirely locally, so you can use it offline or host the single file anywhere.
Tips
- Style-only tweaks (cell size, wall width, solution thickness/color) redraw the current maze instantly.
- Structural changes (dimensions, seed, placement, algorithm, stupid mode) take effect when you click Generate.
- To reproduce a maze exactly, note the Seed used value and re-enter it along with the same settings.
How the "stupid" path works
The generator first pre-carves the obvious route (a few-step monotonic staircase through the middle, or a corridor along the border edge, from start to exit) into the grid. Then the chosen algorithm grows the rest of the maze, but it only ever connects unvisited cells to what's already carved — it never adds a shortcut across the pre-carved route. Since a spanning tree has exactly one path between any two cells, the obvious corridor remains the single true solution no matter which generation algorithm you pick.
License
MIT
Generated and human-reviewed by Al Sweigart