21 lines
700 B
Markdown
21 lines
700 B
Markdown
MazeMaker
|
|
=========
|
|
|
|
MazeMaker generates a random block maze and draws the maze in a PNG image.
|
|
The maze is generated by creating a graph, with the array of blocks as
|
|
nodes, and with edges between blocks that are adjacent either up, down,
|
|
left, or right. Random weights are assigned to the edges, and Prim's
|
|
algorithm finds the minimum spanning tree.
|
|
|
|
The result is a block maze where there are no cycles, every block in the array
|
|
is accessible, and there is exactly one path from any one block to any other.
|
|
The maze is drawn with openings at the lower left and upper right corner,
|
|
suggesting a starting point and ending point.
|
|
|
|
Usage
|
|
-----
|
|
|
|
```
|
|
mazemaker -w NUM_BLOCKS -h NUM_BLOCKS output.png
|
|
```
|