[go: up one dir, main page]

Skip to content

vantoozz/maze

Repository files navigation

Maze Generator

➜ 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

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

Height is optional

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

Output as JSON

➜ 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]
]

Releases

No releases published

Packages

No packages published

Languages