Well, I finally completed a little toy project I’d been working on, off and on, for a while.
It’s a program written in PostScript that generates random mazes. You can try it out, and a random maze will be generated to a PDF file which you will see (if you have Adobe Acrobat Reader or some other PDF viewer). I have another version which produces six mazes to a page. The original PostScript version (which you can download here) can be configured to print an arbitrary number of mazes to a page, and was written using the Test-Driven Development paradigm (so it includes a fairly complete set of regression tests).
I wrote it after I read the source code to the program “Amazing”, written in BASIC, which was presented in a book I used to read when I was a kid, to try things out on my TRS-80 or in Microsoft BASIC on my Macintosh Plus.
I dug up the source code again while I was searching for code to simple, text-based games that I could use as means to teach the C programming language to newbies. The example from the BASIC Computer Games book was rather illegible, and I spent a weekend deciphering it so I could understand the underlying algorithm. In the process, I ended up finding a couple bugs in the progress, such as the occasional omission of the maze exit point, or generating unreachable locations in the maze. I wish now that I’d found the original version of the program, which is much more readable. I think David Ahl’s version from the book must have been written to conserve absolutely as much space as possible, at the expense of comprehensibility.
Pingback: micah.cowan.name » Cool Little Maze
Pingback: micah.cowan.name » How Strange Am I?