Skip to content

Mazex is a tool for generating mazes using different algorithms and rendering them as png images.

License

Notifications You must be signed in to change notification settings

alexandrubagu/mazex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mazex

Mazex is a tool for generating mazes using different algorithms and rendering them as png images.

| Instalation | Usage | Algorithms | License

Instalation

In order to generate mazes with mazex you need to have Elixir installed.

After that you can clone this repository and compile the project by running mix compile

Usage

Maze can be generated by using mix mazex task. The task accepts the following options:

## Options

    --rows             # Number of rows for the maze
    --columns          # Number of columns for the maze
    --algorithm        # One of the following algorithms: aldous_broder, binary_tree, kruskal, prim, recursive_backtracker, sidewinder, wilson
    --output           # Output folder if not given it will use the current folder as output folder
    --filename         # File name to be used for generated maze image, if not given it will use the maze_<current_timestamp>.png.

Example:

mix mazex --rows=10 --columns=15 --algorithm=binary_tree

mix mazex --rows=10 --columns=15 --algorithm=sidewinder --output=/tmp --filename=maze.png

Algorithms

Supported maze algorithms:

Binary Tree

Binary Tree produces mazes by visiting each cell in a grid and carving a passage either south or east. This causes a bias toward paths which flow down and to the right.

binary_tree

Sidewinder

Sidewinder is based upon Binary Tree, but tries to group adjacent cells together before carving a passage south from one of them.

sidewinder

Aldous Broder

Aldous-Broder picks a random cell in the grid and the does a random walk by choosing a random unvisited neighbor. The algorithm ends when all cells have been visited.

aldous_broder

Wilson

Wilson's starts at a random cell and then does a random walk. When it introduces a loop by coming back to a visited cell, it erases the loop then continues the random walk from that point. The algorithm produces a completely unbiased maze.

wilson

Recursive Backtracker

Recursive Backtracker uses a random-walk algorithm. When it encounters a dead end, it backtracks to the last unvisited cell and resumes the random walk from that position. It completes when it backtracks to the starting cell.

recursive_backtracker

Kruskal

Kruskal's algorithm is focused on generating a minimum spanning tree.

kruskal

Prim

Prim's algorithm generates a minimum spanning tree by starting with a position and adding the cheapest edge available. Weights are assigned randomly to ensure a less biased maze.

prim

License

Copyright © Alexandru Bogdan Bâgu

Distributed under the MIT License.

About

Mazex is a tool for generating mazes using different algorithms and rendering them as png images.

Topics

Resources

License

Stars

Watchers

Forks

Languages