A maze solver and generator.
maze.py [-h] [-s | -g rows cols] [--pretty]
When neither -s
nor -g
option is given, maze.py
prints the maze specified at input.
Option | Meaning |
---|---|
-h , --help |
Show help message and exit. |
-s , --solve |
Solve maze. |
-g rows cols , --generate rows cols |
Generate maze with specified size. |
--pretty |
Pretty-print the results. |
A maze consist of 0
's, 1
's, and 2
's, where 0
means an empty cell, 1
means a wall, and 2
is a cell, which is a part of the solution path.
The number of rows and columns should be odd.
11111111111
10022222101
11121112222
10122210111
10111210001
12222211101
12111110101
12010000001
22111010111
10010010001
11111111111