Skip to content

tenault/labyrinth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧶 Labyrinth

A quick-and-dirty program to generate mazes with box-drawing characters.

usage

Installation

Snag the binary from the latest release, or if you've got Rust you can build it yourself with cargo run

Usage

labyrinth <width> <height>

Examples

labyrinth 16 8
┏━┯━━━━━━━┯━━━━━━━┯━━━━━━━━━┯━━━┓
┃ │ ┌───╴ └───┐ ╷ │ ┌─────┐ │ ╷ ┃
┃ │ │ ╶─┬───┐ │ │ ╵ ╵ ╷ ┌─┘ │ │ ┃
┃ │ ├───┘ ┌─┘ │ └─┬───┼─┘ ┌─┘ │ ┃
┃ │ ╵ ┌───┘ ┌─┴───┤ ╷ │ ┌─┘ ┌─┘ ┃
┃ └───┤ ╶───┘ ┌─┐ ╵ │ │ ╵ ┌─┘ ╷ ┃
┃ ╶─┐ └─┬───┬─┘ └───┤ └───┘ ┌─┘ ┃
┠─╴ │ ╶─┘ ╷ ╵ ╶───┐ └───────┘ ╶─┨
┗━━━┷━━━━━┷━━━━━━━┷━━━━━━━━━━━━━┛

The output is just a string sent to stdout, so pipes and redirects work too:

labyrinth 25 25 > maze.txt
cat maze.txt
┏━━━┯━━━┯━━━┯━━━━━━━━━━━━━━━━━━━┯━━━━━┯━━━━━━━━━━━┓
┃ ┌─┘ ╷ ╵ ╷ ╵ ┌─────╴ ┌─────┬─╴ ╵ ┌─┐ │ ╶───┬─┬─╴ ┃
┃ ╵ ┌─┴─┬─┴─┬─┘ ┌───╴ │ ╶─┐ └─┬───┤ ╵ ├───╴ │ │ ╶─┨
┃ ┌─┘ ╶─┘ ╷ │ ╷ ├─────┴─┐ └─┐ └─┐ │ ┌─┴─┐ ╶─┘ └─┐ ┃
┃ └─────┬─┘ │ │ │ ┌───┐ └─╴ └─┐ │ │ ╵ ╷ ├─────╴ │ ┃
┠─────┐ │ ┌─┘ ├─┘ │ ╷ └─────┬─┘ │ └───┤ └─┐ ╶─┬─┘ ┃
┃ ┌─╴ │ ╵ │ ╷ │ ┌─┘ │ ┌───╴ │ ┌─┤ ┌─┐ └─╴ ├─╴ │ ╷ ┃
┃ └─┬─┴─╴ │ └─┘ ├───┘ ├─────┘ │ ╵ ╵ └─────┴───┘ │ ┃
┃ ╷ │ ╶───┼─────┘ ┌─╴ │ ╶─┬───┴───┬─────┬───────┘ ┃
┠─┘ ├───┐ │ ╷ ╷ ┌─┴─┐ └─┐ │ ╶─┐ ╶─┤ ┌─┐ └─┐ ╶─┬───┨
┃ ╶─┤ ╷ ╵ │ │ └─┘ ╷ └───┤ ╵ ┌─┴─╴ │ │ └─┐ ├─╴ └─╴ ┃
┃ ╷ ╵ ├───┤ ├─────┴─┬─╴ └───┤ ╷ ┌─┘ ╵ ┌─┘ ├───┬─╴ ┃
┃ └───┴─┐ ╵ │ ╷ ┌───┘ ┌───┐ │ └─┘ ┌─┬─┘ ┌─┘ ╷ └─┐ ┃
┠─────┐ │ ╶─┴─┘ │ ╶───┤ ┌─┘ ├─────┘ │ ╶─┤ ╶─┴─┐ │ ┃
┃ ╶─┐ │ └───┬───┴───┐ │ │ ┌─┘ ┌───╴ └─┐ ╵ ┌─┬─┘ │ ┃
┃ ╷ ├─┴───┐ ╵ ┌───┐ ╵ │ ╵ │ ╷ │ ┌───┬─┴───┤ │ ╶─┤ ┃
┃ │ ╵ ╷ ╷ ├───┴─╴ └─┬─┤ ╶─┴─┘ │ │ ╷ │ ╶─┐ │ │ ╷ └─┨
┃ └─┬─┘ │ └─╴ ┌─┬─╴ │ └─┐ ┌───┴─┘ │ └─┐ │ ╵ │ └─┐ ┃
┠─┐ │ ╶─┴─┬───┘ ╵ ╶─┼─╴ │ │ ┌─────┴─┐ ╵ ├───┴─┐ │ ┃
┃ ╵ ├───┐ ├─────┬─╴ ╵ ╷ │ │ │ ╷ ╶─┐ └─┬─┤ ╶───┘ │ ┃
┠───┘ ╷ ╵ │ ╶─┐ │ ┌───┴─┘ │ ├─┴─╴ ├─┐ │ ╵ ╶───┬─┘ ┃
┃ ╶─┬─┘ ┌─┘ ┌─┘ ├─┘ ┌─────┘ │ ┌───┘ ╵ │ ╶─┬───┘ ╷ ┃
┃ ╷ │ ╶─┤ ┌─┤ ┌─┘ ┌─┘ ┌─────┘ │ ╶─────┴───┘ ┌─┬─┘ ┃
┠─┘ ├───┤ │ │ │ ╶─┤ ┌─┴─╴ ┌───┴─────┬─────┬─┘ ╵ ┌─┨
┃ ╶─┘ ╷ ╵ ╵ │ └─╴ │ └─╴ ┌─┘ ╶───┐ ╶─┘ ╷ ╶─┘ ╶───┘ ┃
┗━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━━━┷━━━━━┷━━━━━━━━━━━┛

About

A quick-and-dirty tool to generate mazes with box-drawing characters.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages