Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vantoozz/maze

Maze Generator
https://github.com/vantoozz/maze

maze-generator

Last synced: about 2 months ago
JSON representation

Maze Generator

Awesome Lists containing this project

README

        

# Maze Generator

```shell
➜ maze
Usage: app [OPTIONS]

Options:
-w, --width INT Maze width
-h, --height INT Maze height
-f, --format [ASCII|JSON] Output format
--help Show this message and exit

```

#### Example run

```shell
➜ maze -w 80 -h 25
┌─┬────┬───┬────────────┬──┬─────┬────┬────┬──┬───┬──┬───────┬────────┬────┬────┐
├┐│┌─┬╴│╶─┐├╴╷┌──┬─────┐└─┐│┌───┐│╷┌─╴│┌──┐└╴╷│┌─┐└┬╴│╶┐╶─┐┌─┘┌─┐╶─┬─╴│╶┬─╴│╷╶┬╴│
│╵│╵╷└┐└─╴││╶┼┘┌╴├──┐╷╶┴─┐│││╷┌╴│╵│└┐┌┘│╷╶┴─┬┘│└┐├╴│╶┴┐└─┐││┌─┘┌┴┐╷└┐┌┴─┘┌╴│└┐└─┤
│╶┤┌┴╴├─┬─┘│╷╵┌┘┌┘┌┐│└─┐╶┘╵│└┤├─┤╶┼╴│└╴│└┐╶─┤┌┴┐││┌┴─╴│┌─┘├┘└─╴│╷│├╴│└╴┌┬┘┌┴┐├┬╴│
├┐││╶┬┘╷│┌─┘├─┤╶┘╶┘│└──┴─┬─┴┐╵│╷└─┤╶┴─┬┴┐├─┐│╵╷╵│││╶┬─┤│╶┬┘┌───┘│└┤╶┼──┘│╶┘┌┘││╷│
││└┼╴│┌┴┘├─┐├╴└──┬─┼─┐╶─┐│╷╶┴╴│├─┐│╶─┐├╴││╷│└┬┴┬┘╵├╴│╷╵└┐╵╶┤┌───┼┐│╷│╶──┴┬╴│┌┘│└┤
│└┐╵┌┤╵┌─┤╷│╵┌───┘╷╵╷└┬─┘│└─┬─┤│╷╵└──┘│╷│└┘└┐│╷╵┌─┤╶┘├─┐├┬─┘│╶─┐╵│├┘├─┐╷╶┘┌┘│╷├╴│
│╷├─┘│┌┘╷╵│├─┘┌──╴├─┼╴╵┌─┴─┐│╷│└┼─┬───┤└┴╴┌─┤│└┬┘╷├──┤╷│╵│╶┬┘┌╴│┌┘│╶┤╷└┴┐┌┘┌┘││╷│
││╵┌╴││╷├─┤│╶─┴┬──┘╷└─┐│╶┐╶┘││└┐╵╷│┌─┐│╶┬┬┘╷│└┐└╴│╵┌┐╵│└─┼╴│╶┤╶┴┤╶┼╴│├┬╴├┘╶┴─┤│││
│└┬┴┐│└┘│┌┘│╶┬┐│┌──┼─┐│└┐└┬┬┘│╷└─┤└┘╷│└┐││┌┘│╶┴──┴─┘├─┴─┐│┌┴┐└─┐└┐│╷│││╶┤┌┬─┐╵│└┤
│╷│╷└┴──┘│╶┴┐╵│╵└╴╷│╷│└┐├╴│╵╶┤├──┴─┬┘│╷╵╵││╶┤┌──┬╴┌─┤┌─╴│╵│╷└─┐├┐╵│└┘│└┐│╵│╷├─┴╴│
││╵├┐┌───┴─╴│┌┴┬──┘││└┐└┤╶┼──┤╵┌─┐╷│╶┴┴┐┌┘├┐│╵┌╴│╷│╷╵│╶─┴─┘├┬╴│╵└┬┤┌─┤╶┤╵┌┘││┌─╴│
│├─┘│╵┌──┬──┘│╷└─┐╶┘├╴├┐└┐╵┌┐└┐└╴││└─┬┐└┤╶┤│├─┘┌┤└┘└┬┴┐┌─┐┌┘│┌┴─╴│╵│╶┘╷└┬┘┌┘╵│┌─┤
││╶┐├─┤╶─┘╶──┤└┬┐└┬─┘╶┘├╴├─┘├╴│┌─┤├─╴│├╴└┐╵││╶─┘├─┬─┘╷└┤╷╵│╶┘│╶─┬┘┌┘┌─┘╷│╶┴┬┬┘├╴│
│├╴│└┐╵┌─┬───┴╴│└┐├──┬╴│╶┘┌┐│┌┘│╷│└─┐╵│┌╴└┐│├─┬╴├╴│╶─┼┐│├─┘╶─┼─┐│┌┴─┤┌─┘├─┐│╵┌┘╷│
│╵┌┴╴│╶┤╶┤┌────┴╴││┌╴│╶┼──┘│╵│╶┤│└┬╴├╴││╶┬┘│╵╷└┐│╶┴─┐││╵│┌─┬┐└┐││╵┌┐││╶─┤╷│└┐└╴││
├─┤┌─┴┐└╴││╶┬─┐╶┐││└┐└┐└─┐╷└┬┴┬┘├┐╵┌┴┬┘├─┤╶┼─┴╴│├╴╷┌┘│└─┘│╷│└╴╵│└┬┘╵│└┐┌┘│└╴├──┤│
├╴││╷╶┴─┐│└┐└╴└┐││└╴├┐├┬╴└┘╷╵╷╵┌┘└┐│╷│╶┤╷└╴│╶──┤╵┌┴┘╷├───┤│└┐┌─┼╴│╶─┴╴├┘╷├──┴┬╴││
│┌┘│└┐╶─┘└┐├─╴┌┘│├─┬┘││╵╶┬─┤┌┴┬┘╶─┘││└╴│├┬─┤┌─┐├╴│╶┬┘│╶┬┐│├┐││╷╵┌┴╴┌──┤┌┘│┌─╴│┌┘│
││┌┴╴├─┐┌─┘│┌─┤╶┼┘╷│╷│├──┤╷└┘╷│┌─┐┌┘├──┤╵│╷│╵╷│├─┴┐├─┴┐╵│╵││└┘├─┴──┘┌╴│└─┘│╶┬┘│┌┤
││└┬─┤╷├┘┌─┴┘╷│╷╵╶┤╵│╵│╶┐│├──┤├┘╷└┤╶┤╶┐└┐││├─┘│╵┌┐││╷╷├╴├─┘└──┘┌───┬┘┌┘╶──┼╴│╷│╵│
│└┐│╷╵││╶┘╶┬─┤└┴──┴┐├─┴╴││└┐╶┤│┌┴┐└┐└╴│┌┘│││┌─┤╶┘││╵│├┘┌┴───┬─╴│┌─┐│╶┴┬──╴│╶┤└┴╴│
│╷││├─┤└──┐│╷├─┬─┐╷│└┐╷┌┘│╷├╴││├╴├╴├─┐│╵┌┘│└┤╷└──┤│╶┤│┌┴╴┌─╴│┌┬┘╵╷└┼─┐└┐┌─┴┐└─┐╶┤
│└┤╵│╷└┬─┐└┤│╵╷│╷└┘├┐└┤│╶┼┘│╶┤││╷│┌┘╷└┴┐│┌┴┐│├┬─┐│└┐│╵│╷╶┤╶┬┘││┌─┴┐│╷└┐││┌┐├─┐├╴│
│╷└─┘└─┘╷└╴╵├─┘╵├──┘└╴╵├╴╵┌┘╷╵╵│└┘╵┌┴─╴└┘│╷╵╵│╵╷╵└╴│└─┴┴╴├╴╵┌┘╵└╴╷│╵│╶┘└┘│╵╵╷╵│╶┤
└┴──────┴───┴───┴──────┴──┴─┴──┴───┴─────┴┴──┴─┴───┴─────┴──┴────┴┴─┴────┴──┴─┴─┘
```

#### Height is optional

```shell
➜ maze -w 10
┌┬──┬──┬──┐
││╷╷│┌┐│┌┐│
│└┤└┘╵│╵╵││
├┐├───┴─┬┘│
││╵┌─┬─┐╵╷│
│└─┘╷└┐└┬┤│
│╷╶─┴┐╵╷╵││
│├──┐└┬┴─┘│
││╶─┴┐╵┌─┬┤
│└──╴└─┘╷╵│
└───────┴─┘
```

#### Output as JSON

```shell
➜ maze -w 10 -h 5 -f json
[
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1],
[1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,0,1],
[1,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1],
[1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1],
[1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,1],
[1,0,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1],
[1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1],
[1,0,1,0,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1],
[1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
]
```