Mazes Again
Some of you may have heard that my 326 course last year spent weeks
making mazes and more mazes. Well, I just couldn't resist giving you a
chance to have a little maze fun. So, here is a program that reads
mazes from files (and writes them to files) and can search them for
solutions. Play with it! See if you can add some interesting new
features to the maze (and fix the search code to account for those)
like traps or multiple level mazes or tunnels. See if you can write a
search that finds all paths through the maze (that never dead-end) or
finds the shortest path (you might need something called a
"queue" to do that, but there are other ways). Add named
places to the maze with a format like this:
3 7 Piccadilly Square
2 1 Hyde Park
5 3 Isengard
Then, print out paths as directions from landmark to landmark rather
than as mazes with '.' marks. (This will be good I/O practice!) Try
automatically generating mazes. To do this, try thinking of a mole
blindly digging about in an initially solid block of dirt. There
actually is a fascinating, extremely efficient algorithm for
generating mazes, but that's a story with a great deal of new data
structures and ideas!
Anyway, have fun with it!