WilliamHPNielsen / limnos

Other
0 stars 0 forks source link

Limnos

A cool maze!

Welcome to limnos, a python library for generating mazes!

What problem does limnos solve?

A child comes up to you, yanking you sleeve, saying "I'm bored, I want to solve a maze!". You don't really have the time nor the energy to draw one, so instead to turn to limnos to autogenerate a random maze for you.

What kind of mazes can I generate?

Currently, all mazes are on an N x M grid. All mazes have a unique solution, there are no cycles in any mazes. All points on the grid are reachable from the starting position (and thus from any other point). All solutions run from the lower lefthand corner to the upper right hand corner.

Installation

Installation is only possible from source (limnos is not yet on pypi). Note that limnos requires python 3.9.

Using pipenv

Simply pipenv install in the root directory.

Not using pipenv

Erm... I suppose you can manually pip install each of the packages listed in the PipFile (except limnos) and then pip install . or pip install -e . in the root directory.

Contribution

Contributions most welcome! See the list of open issues as inspiration and feel free to add to the list.

The Contributor Covenant code of conduct applies to the development of and community around limnos.

Usage

Being a library, limnos must be imported and used in a python session (there are plans to make a CLI at some point).


from limnos.generation import trails_generator, walls_from_trails
from limnos.visualisation import plot_maze

# Generate the trails of an NxM maze
# these are all the paths one can walk
trails = trails_generator(N=10, M=10)

# Generate the walls of the maze
walls = walls_from_trails(trails)

# Plot the maze. Showing the solution is optional
plot_maze((trails.main, walls), show_route=True)

The plot_maze command gives you a matplotlib figure which you can save as pdf and print out.