Project

amaze

0.0
No commit activity in last 3 years
No release in over 3 years
A maze generator inspired by the book of Jamis Buck, Mazes for Programmers: Code Your Own Twisty Little Passages.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 10.0
~> 3.0

Runtime

 Project Readme

Gem Version

Amaze

Amaze is both a ruby library and a command line tool to generate mazes.

I love mazes. The beauty of mazes have always fascinated me. Amaze is a personal project to create mazes with different tesselations, shapes and sizes. The wonderful book of Jamis Buck, Mazes for Programmers: Code Your Own Twisty Little Passages was a great source of inspiration. To adapt the ideas, the code and add my own little twists was a lot of fun.

Visit Think Labyrinth: Maze Algorithms if you want to explore more on mazes, their classification, creation and solving algorithms.

Installation

Amaze depends on RMagick to generate png images. RMagick is an interface between the Ruby programming language and the ImageMagick image processing library. You have to install imagemagick first before installing amaze.

On OS X install imagemagick with brew

$ brew install imagemagick

On Ubuntu

$ sudo apt-get install libmagickwand-dev

Then run

$ gem install amaze

Amaze has been tested on OS X 10.11.x and Ubuntu 16.04 with ruby 2.3.x.

Usage

Execute amaze --help for a short description of all supported options.

Generate a simple ASCII maze

$ amaze

+---+---+---+---+
|               |
+   +---+   +---+
|       |       |
+   +---+---+   +
|   |           |
+   +   +---+   +
|   |   |       |
+---+---+---+---+
Growing tree (last from list) algorithm: 0.00012327899457886815s
Dead ends: 5 of 16 (31%)
Random seed: 130944739226911434163498228124148718585

Make it a little bigger

$ amaze -g 12

How about a sigma grid

$ amaze --type sigma

 ___     ___
/   \___/   \___
\        ___    \
/   \___/    ___/
\   /    ___/   \
/   \   /   \   /
\   /   \       \
/   \___/   \   /
\___     ___/   \
    \___/   \___/
Growing tree (last from list) algorithm: 0.00015847600298002362s
Dead ends: 3 of 16 (18%)
Random seed: 210159208462445383832077802753403683598

Want to visualize the longest path through the maze (it will be nicely colored in your terminal)

$ exe/amaze --longest

+---+---+---+---+
| ∙ | ∙-------∙ |
+ | + | +---+ | +
| | | ∙---∙ | ∙ |
+ | +---+ | +---+
| ∙---∙ | ∙---∙ |
+---+ | +---+ | +
|     ∙-------∙ |
+---+---+---+---+
Growing tree (last from list) algorithm: 0.00013193400809541345s
Dead ends: 3 of 16 (18%)
Path length: 14
Random seed: 21088416182148741326253564379123099432

How about watching the algorithm doing its work?

$ amaze --visualize

Watching the alogorithm generating a maze

You can choose between different algorithm (try Hunt and Kill next)

$ amaze --visualize --algorithm hk

Finally you can render your maze as PNG

$ amaze --format=image
Growing tree (last from list) algorithm: 0.00013603299157693982s
Dead ends: 3 of 16 (18%)
Random seed: 72618483828743227022428199116847991100
Maze 'maze.png' saved.

... and a last example

$ amaze --type ortho -g 12 --format image --distances --longest

will render something like this:

Image of an ortho maze with color coded distances and longest path

Amaze has a lot more options to play with. Have fun and create beautiful pieces of algorithmic art.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/pmarchi/amaze.

License

The gem is available as open source under the terms of the MIT License.