Knossos

A library for generating mazes inspired by Mazes for Programmers by Jamis Buck and Think Labyrinth! by Walter Pullen.

Installation

Add the following line to your application's Gemfile:

gem 'knossos'

Or install the library globally with:

~$ gem install knossos

Usage

#!/usr/bin/env ruby

require 'knossos'

grid = Knossos::Grid.new({rows: 5, columns: 5})
carver = Knossos::Algorithm::BinaryTree.new
carver.carve(grid: grid)

text_renderer = Knossos::Renderer::Text.new
puts text_renderer.render(grid: grid)

image_renderer = Knossos::Renderer::Image.new(grid)
png = image_renderer.render
png.save("maze.png")

Contributing

Bug reports and pull requests are welcome on GitHub. Knossos provides a safe, welcoming space for collaboration. Everyone contributing to our project—including the codebase, issue trackers, chat, email, social media and the like—is expected to uphold our Code of Conduct.

Setting Up

Fork the project on GitHub and make a local clone. Install dependencies, and run the tests:

~/knossos$ bin/setup
~/knossos$ bundle exec rake rspec

Running the Code

You can experiment with the code interactively using:

~/knossos$ bin/console

Publishing

To release a new version of the library, first increment the version number in lib/knossos/version.rb following Semantic Versioning policy, and update CHANGELOG.md. Commit your work, and finally, run:

# Create a git tag, push commits and tags, and publish to rubygems.org
~/knossos$ bundle exec rake release

License

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


This file is composed with GitHub Flavored Markdown.