by Kirk Baucom
TextMaze generates random mazes on a text terminal and lets you traverse
them using the arrow keys.
If you play with TextMaze and enjoy it, I'd appreciate an email letting me know
that you liked it.
It's just a perl script, so all you have to do is make sure it's executable
and put it somewhere convenient, like /usr/local/bin or /usr/local/games.
After you run it the first time, it will create a .textmaze config file in
your home directory.
You must have the Curses module, which you can get from
Kyle Guilbert : maze solve code
Juan Orlandini : move count, additional move keys
-r sets the rows of the maze to
-c sets the columns of the maze to
-m generate a maze that is the maximum size allowed by your screen
-d generate the maze in "dissolve" mode, slower but fun to watch
-s provide a seed value for generating a maze\n";
-a use ANSI color
-h prints a summary of the command line options, along with
default and maximum maze sizes
Default Keys while playing
Movement: Arrow keys, or vi movment keys (h,j,k,l)
Redraw the screen: r
Toggle ANSI color: c
Solve the maze: s
A Note on TERM settings
Certain features depend on the capabilities of your terminal, and your TERM
setting. Specifically, the three features you might not have are:
- Hiding the cursor
- Doing color
- Drawing underlined characters
If you can't hide the cursor, dissolve mode looks kind of goofy. If you
can't do underlines, you can't tell if there is a wall beneath your
Running textmaze without arguments will generate a maze that is either the
default of 20 by 20, or the largest size it can fit on your screen if it is
smaller than that. Each cell in the maze requires 1 row and 2 columns, plus
1 row and 1 column for the border. so a maze that is 20 units high will use
21 rows, and a maze that is 20 units wide will use 41 columns. So the largest
maze you can fit on an 80 x 24 terminal window is 39 x 23.
The formula for calculating your score is:
( Maze Height * Maze Width ) *
( Minimum Moves / Total moves ) *
( ( Minimum Moves / ( Time Take * 2 ) )
So a "perfect" score is the same as the area of the maze (eg. a perfect
score for a 5 by 5 maze would be 25). You can get a "time bonus" by
finishing the maze faster than two moves per second.
I didn't do the ASCII art that appears when you finish the maze. I got it
from someone else several years ago, and unfortunately I can't remember who
it was. If you happen to know, or happen to be them, let me know.