Glenda vs Tux -- a puzzle
News:
5/9/2004:
- YAMANASHI Takeshi [uncover (at) breat...titech.jp] added mouse control -- something completely overlooked by me because i wrote the thing on my laptop. New code includes his changes. Also added is middle-button-driven level changer.
- Added a rudimentary level evolver. I've been running it on a few opterons and despite how bad it is it still gets a few decent levels every once in a while. Still, popcap's "mummymaze" levels are much better thought out.
Intro:
This is an implementation from scratch of the "Theseus and the Minotaur" puzzle, originally created by Robert Abbott for his book Mad Mazes : Intriguing Mind Twisters for Puzzle Buffs, Game Nuts and Other Smart People; original site containing much more information is located here.
Download:
maze.tgz -- this is the real thing, for Plan 9.
maze-9port.tgz -- this one compiles for
plan9port.
evolve.c -- a very silly level generator; randomly
evolves a maze and tries to solve it, printing out the score for the board
(i.e. how many moves it takes to reach the goal).
Screenshot:
Description:
Help Glenda escape the mad penguin (just kidding, both are chosen to be cute and non-violent, just don't let them be in the same spot at the same time).
You are guiding Glenda, the Plan 9 Bunny, through a room full of walls (marked in grey). Your goal is to reach the square marked "e" (as in "exit") and go to the next room. The Penguin, call him Tux, will chase you each step of the way. If it catches you -- chainsaw action ensues!
The rooms have walls -- neither Glenda nor Tux can go through them.
Rules:
Tux makes two moves for each move by Glenda. The goal is to trap Tux between walls so he can't go after you.
Note that Tux always moves horizontally first, then vertically if needed. This is the key to your success.
Once Glenda reaches the exit square (marked by "e") the game will load the next level. There are 16 levels currently, all at the "easy" ballpark. More serious ones may come once I've found a few good candidates (I'm evolving mazes with a fitness function based on the length of the path to the finish, it doesn't look so well right now :).
Controls:
Arrow keys move Glenda up-down-left-right. Space bar skips a move. Del quits.
Glenda also responds to mouse clicks in the squares next to her (thanks Takeshi!).
The right mouse button invokes a menu where you can choose to restart a level after Tux caught you or you made a wrong move, or to exit.
The middle mouse button lets you change between levels.
Technical:
Some of the levels are taken from PopCap's "MummyMaze" game. If you have java and want to see how a much better implementation looks like go to their web site: http://www.popcap.com/gamepopup.php?theGame=mummymaze.
Look in levels.h for design hints for the levels. You may want to evolve mazes yourself, which is the easiest way to create new ones. Rewriting a "mummymaze" room for our maze code takes about 3 minutes.
The code in the game is designed very poorly -- it was kind of thrown together for a very short period of time (5 hours in all) and without much thought on how to clean up the design. Lots of global variables and functions taking and returning voids as arguments. I am ashamed...
The game does not install itself anywhere -- play from the current directory (I can put the images in /sys/games/lib/maze sometime in the future, if people turn out to like it).
You can change the images shown by changing the files in images/. Just make sure they're 36x36 pixels.
Only 700 lines of code. All Hail Plan 9.
BUGS:
No resize.
Except for the crappy code design I don't think I've found anything that crashes it yet.
Oh, i think there is one -- it took 5-6 hours to write the basic games, 3-4 more to get levels in, you can really tell by looking at it, can't you?
One more -- levels should probably not be compiled in but parsed from files.
Last Modified: September 06, 2004
mirtchovski at gmail