Giter Club home page Giter Club logo

maze-rs's Introduction

maze-rs

Maze for Programmers (Rust)

Status

Build Status

Prerequisites

Usage

$ ./target/debug/maze -h
Maze Generator 0.1.2
Tomas Korcak <[email protected]>

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

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

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

maze-rs's People

Contributors

korczis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

bramp

maze-rs's Issues

Program Arguments as Params (Structure)

$ ./target/debug/maze -h
Maze Generator 0.1.2
Tomas Korcak <[email protected]>

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]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.