3 releases

Uses old Rust 2015

0.1.2 Nov 14, 2016
0.1.1 Nov 13, 2016
0.1.0 Nov 13, 2016

#206 in #fun

MIT license

33KB
758 lines

maze-rs

Maze for Programmers (Rust)

Status

Build Status

Prerequisites

Usage

$ ./target/debug/maze -h
Maze Generator 0.1.2
Tomas Korcak <korczis@gmail.com>

USAGE:
    maze [FLAGS] [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -r, --rest       Run REST Server
    -V, --version    Prints version information
    -v, --verbose    Verbose mode

OPTIONS:
    -a, --algorithm <algorithm>      Algorithm to use [default: aldous-broder]  [values:
                                     aldous-broder, binary, sidewinder]
    -c, --cell-size <cell-size>      Size of Cell [default: 80]
        --color-cell <color-cell>    Color of Cell [default: #fff]
        --color-wall <color-wall>    Color of Wall [default: #000]
    -f, --format <format>            Output format to use [default: ascii]  [values: ascii, json,
                                     png]
    -y, --height <height>            Height of Maze [default: 5]
    -p, --rest-port <rest-port>      REST Port [default: 5000]
    -w, --wall-size <wall-size>      Size of Wall [default: 20]
    -x, --width <width>              Width of Maze [default: 5]

Generator Algoritms

  • Aldous-Broder
  • Binary
  • Sidewinder

Output Formats

  • ASCII Art
  • PNG
  • JSON

Benchmark

Low-Level Benchmark

$ cd dev/maze-rs/
tomaskorcak@kx-mac ~/dev/maze-rs$ cargo bench
    Finished release [optimized] target(s) in 0.0 secs
     Running target/release/deps/maze-0b23e703e6e9e01c

running 6 tests
test generator::aldous_broder::tests::bench_generate_100x100 ... bench:  61,610,364 ns/iter (+/- 24,858,439)
test generator::aldous_broder::tests::bench_generate_10x10   ... bench:     214,587 ns/iter (+/- 59,722)
test generator::binary::tests::bench_generate_100x100        ... bench:   5,123,808 ns/iter (+/- 976,614)
test generator::binary::tests::bench_generate_10x10          ... bench:      38,307 ns/iter (+/- 10,100)
test generator::sidewinder::tests::bench_generate_100x100    ... bench:   5,063,132 ns/iter (+/- 1,187,545)
test generator::sidewinder::tests::bench_generate_10x10      ... bench:      38,009 ns/iter (+/- 9,281)

test result: ok. 0 passed; 0 failed; 0 ignored; 6 measured

     Running target/release/maze-1018e5569854def3

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

Aldous-Broder

$ time ./target/release/maze -a aldous-broder -x 1000 -y 1000 > maze.txt

real	0m16.928s
user	0m13.188s
sys	0m3.555s

Binary

$ time ./target/release/maze -a binary -x 1000 -y 1000 > maze.txt

real	0m1.804s
user	0m1.476s
sys	0m0.268s

Sidewinder

$ time ./target/release/maze -a sidewinder -x 1000 -y 1000 > maze.txt

real	0m1.953s
user	0m1.539s
sys	0m0.299s

Example

$ ./target/debug/maze -x 20 -y 20

+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|   |       |   |   |           |               |   |                   |       |
+   +---+   +   +   +   +---+   +   +   +   +   +   +---+---+---+---+   +---+   +
|           |               |       |   |   |   |               |       |       |
+---+---+   +---+   +---+   +---+---+---+   +   +---+   +   +---+   +---+---+   +
|   |       |   |   |   |       |           |   |       |           |           |
+   +   +   +   +   +   +---+   +---+---+   +---+   +   +   +---+   +   +---+   +
|   |   |   |       |   |       |   |   |   |       |   |   |   |           |   |
+   +   +---+   +---+   +   +---+   +   +---+---+---+   +   +   +---+---+   +---+
|                   |           |       |               |   |   |       |       |
+---+---+---+---+   +---+   +   +---+   +   +   +---+   +   +   +---+   +   +   +
|                       |   |               |       |   |               |   |   |
+   +   +---+   +   +---+---+---+---+---+---+---+   +   +---+   +   +---+   +---+
|   |   |       |   |                   |   |   |   |   |       |       |       |
+   +   +---+---+   +   +---+---+   +   +   +   +   +---+---+   +---+---+---+---+
|   |           |       |   |       |   |                   |       |   |   |   |
+---+---+   +---+---+---+   +---+   +---+---+   +   +   +---+   +   +   +   +   +
|                   |   |       |           |   |   |   |   |   |       |       |
+   +---+   +   +   +   +---+   +---+---+---+---+   +   +   +---+   +---+---+   +
|   |       |   |       |   |           |       |   |   |       |           |   |
+   +---+---+---+   +   +   +---+   +---+---+   +---+---+   +---+---+   +---+   +
|   |   |   |       |                   |               |       |   |       |   |
+---+   +   +   +   +---+---+   +   +---+   +---+   +   +---+   +   +---+   +   +
|       |   |   |   |       |   |           |   |   |           |   |           |
+---+   +   +---+---+   +---+   +   +---+   +   +---+---+---+   +   +   +---+---+
|                               |       |   |   |   |           |   |           |
+   +---+   +   +---+---+   +---+   +---+---+   +   +   +---+   +   +---+   +   +
|   |       |   |   |       |   |       |   |       |   |   |       |   |   |   |
+---+---+   +---+   +   +   +   +   +   +   +---+   +---+   +   +   +   +---+---+
|       |   |           |       |   |           |   |           |       |       |
+---+   +---+   +---+---+---+   +---+---+   +   +   +   +   +---+---+   +---+   +
|   |   |       |                   |       |   |       |       |   |           |
+   +   +---+---+   +---+   +---+---+---+   +   +---+---+---+   +   +---+---+   +
|       |   |   |   |                   |   |   |   |           |   |   |       |
+   +---+   +   +   +   +---+---+   +---+   +   +   +---+---+   +   +   +---+   +
|           |       |   |       |   |       |   |       |   |           |   |   |
+   +---+---+   +---+---+   +   +   +---+---+---+   +   +   +   +   +   +   +   +
|               |           |           |   |       |   |       |   |       |   |
+   +---+   +---+---+   +---+---+---+---+   +   +---+---+   +---+---+   +   +   +
|   |       |           |                                   |           |   |   |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Dependencies

~18MB
~361K SLoC