License Rust

Knossos

Knossos is a Rust library for generating mazes with some basic routines for rendering and saving mazes to files.

Reference

In Greek mythology, King Minos dwelt in a palace at Knossos. He hired the Athenian architect, mathematician, and inventor Daedalus to design his palace and so cleverly was it constructed that no one who entered could find their way back out without a guide. In other versions of this same story it was not the palace itself which was designed in this way but the labyrinth within the palace which was built to house the half-man/half-bull the Minotaur. In order to keep Daedalus from telling the secrets of the palace, Minos locked him and his son Icarus in a high tower at Knossos and kept them prisoner. Daedalus fashioned wings made of wax and bird's feathers for himself and his son, however, and escaped their prison but Icarus, flying too close to the sun, melted his wings and fell to his death.

Source: https://www.worldhistory.org/knossos

Overview

Knossos currently supports only one type of mazes: orthogonal, which is a standard maze layout of rectangular passages.

The library supports the following generation algorithms:

Knossos supports the following output types:

Installation

Add this to your Cargo.toml

no_test [dependencies] knossos = "0.1.0"

Usage

Knossos is designed to be super easy and convenient to use. Here are some usage examples of how to generate, display and save mazes:

Generate with default parameters

```rust,no_run use knossos::maze::*;

let maze = OrthogonalMazeBuilder::new().build(); ```

Generate with custom parameters

```rust,no_run use knossos::maze::*;

let maze = OrthogonalMazeBuilder::new() .height(10) .width(10) .algorithm(Box::new(GrowingTree::new(Method::Random))) .build(); ```

Display

```rust,no_run use knossos::maze::*;

let maze = OrthogonalMazeBuilder::new().build(); println!("{}", &maze); ```

Save to file

```rust,no_run use knossos::maze::*;

let maze = OrthogonalMazeBuilder::new().build();

// Save as ascii maze.save("output/maze.txt", Ascii).unwrap(); // Save as a game map maze.save("output/mazegamemap.txt", GameMap::new().span(3)).unwrap(); // Save as a PNG image maze.save("output/maze.png", Image::new().wall(10).passage(30)).unwrap(); ```

You can find more examples in src/main.rs