https://github.com/adimit/amazegen
A simple maze generator.
https://github.com/adimit/amazegen
Last synced: 9 months ago
JSON representation
A simple maze generator.
- Host: GitHub
- URL: https://github.com/adimit/amazegen
- Owner: adimit
- Created: 2023-01-12T21:13:34.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-18T06:07:36.000Z (over 1 year ago)
- Last Synced: 2025-03-18T15:54:20.578Z (about 1 year ago)
- Language: Rust
- Homepage: https://aleks.bg/maze
- Size: 965 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.org
Awesome Lists containing this project
README
* A Maze Generator
** Mission Statement
A collection of maze generation algorithms, interesting visualisations, and a web interface UI. The algorithms and visualisations are written in [[https://www.rust-lang.org/][Rust]] and compiled to [[https://webassembly.org][WebAssembly]] so they can be used in a browser. Here's an example:
[[./docs/maze-15-15-720910203442283167.svg]]
** Status
The project is currently an MVP. It is hosted at https://aleks.bg/maze where you can tweak maze generation parameters. The web page provides a unique link to every generated maze[fn:1]. You can populate a PDF file with an arbitrary amount of mazes (one per page) and print them. The printed mazes have QR code backlinks to the site so you can check for a solution later.
There's a command line application that similarly accepts the maze's parameters and random seed and outputs an SVG file with the maze's parameters as its name.
You can use one of two algorithms to create the mazes:
- "Growing Tree" (based on [[https://en.wikipedia.org/wiki/Vojt%C4%9Bch_Jarn%C3%ADk][Jarník's]], aka [[https://en.wikipedia.org/wiki/Prim%27s_algorithm][Prim's spanning tree algorithm]]) with a hard coded selection criterion that means the algorithm degenerates to a randomised depth-first search. Creates few, long, meandering passages
- "Kruskal's Algorithm" (based on [[https://en.wikipedia.org/wiki/Kruskal's_algorithm][Kruskal's spanning tree algorithm]]). Creates mazes with lots of intersections and many short passages
[fn:1] Note that the backlinks are not stable yet, and the maze you see when you follow a link may not be the one you printed as internals may change at any time.
You can also choose between different shapes of the overall maze: a square or a circle are available. The latter is also known as a θ-maze.
Circular mazes have an interesting property: their cell count grows: $2^{log_2(n)}$ where $n$ is the amount of rings. Compare square mazes that grow at $n^2$. In practice, the number of cells in a given θ-maze is
$$1 + \sum_{i=1}^{i