Adventures in the Imaginary Land of Gack


In this lab you will work on your own. You will be using object-oriented programming to extend an adventure game, the Land of Gack. This game is explained in section 14.5 of the text, so you should read that section before coming to lab.

In lab

The code for the game has been divided into a collection of individual files, but for convenience there is a single ``master file'' called game.scm which loads all the others in. So, the first thing you should do is to copy the whole collection of files and modify game.scm so that it loads in your copy of the other files, rather than the original copies. That way you will always be able to load your whole set of files in just by loading in your game.scm. If you add any additional files (for example, for newly added classes), you should extend your game.scm to load in the new files as well.

To make a copy of all the files, the simplest approach would be to use the shell to copy the whole directory containing the files. If you are in a shell window type

        cp -r ~mc28/labs/gack .
(note that this command ends with a space and then a period), you will get a subdirectory called gack containing all the files. Ask for help with this if you need it. You can then open up the game.scm file in this directory and edit it to contain the full pathname of the directory, as the place to load the remaining files from.

Following are links to the various files that comprise the program, together with short descriptions. These links should be useful when you are programming, since you will typically be working on one of the class files, but will need information about various other classes or utility procedures.

When you make changes, it will be least confusing if you save the changes out and then re-load game.scm, thereby getting a fresh copy of the whole game. That way you won't encounter weird problems like having two persons both called Max (one is bad enough!) or having two different person classes, one old and one new.

Once you have copies of the files made and loaded in, you are to do exercises 14.33, 14.34, and 14.35, on pages 568 through 570. In coming up with ideas for the open-ended exercise 14.35, you may also want to look at exercise 14.42 on pages 572 and 573.


Write up a lab report that explains the final program to an audience generally knowledgeable about Scheme. One thing I'll be looking for is a clear description of your final class hierarchy early in the report. (A diagram helps!) As always, emphasize the final product rather than each incremental change you made.