Project 7: Adventures in the Imaginary Land of Gack

Start: 5/10/2016

Due: 5/18/2016, by midnight (no late project will be accepted!)


Overview

In this lab you will use object-oriented programming to extend an adventure game, the Land of Gack. This game is explained in Section 5 of Chapter 14 of Concrete Abstractions (starting on page 543) and we will spend a day or two discussing the Java version you'll be working with. Your work in this project is very open-ended; you can choose for yourself how to extend the game. I strongly encourage you to talk over with us the choices you have made, not only with regard to new game features but also with regard to how they are programmed.

Differences in the Java version

Prof. Karl Knight did a complete re-write of the Land of Gack program from the original Scheme version, which is your starting point (see below). I am also providing the Javadoc-generated documentation. There are some differences from the Scheme version in the book:

Specific tasks

  1. Download Project7.zip and import it into your workspace. You can run the program by running the file Game.java. Do so. Then spend a little time exploring the project, using the Javadocs as well as the source code.

  2. Once you have a copy of the game, you are to do exercises 14.33, 14.34, and 14.35. In coming up with ideas for the open-ended exercise 14.35, you may also want to look at exercise 14.42. All four of these exercises are reproduced below with minor editing to suit the current Java context. Be sure in the open-ended exercise to make changes which require all three of the following: some addition to the class hierarchy, some additional method, and some additional attribute (instance variable). This is a grading criterion for your project report.

  3. Exercise 14.33: First you'll need to familiarize yourself with the game. Run it as described above. Try to get from the dormitory to the computer lab without getting turned into a frog along the way. To make it more challenging, try to get to the lab possessing the scroll of enlightenment. If you want, you can make the other characters move more often relative to your own moves by using the numerical control at the top center of the game window. Be sure to get familiar with the game's other features too.

  4. Exercise 14.34: Modify the Land of Gack so that there is a new scroll, called "late lab report", in the dormitory. Now you can play the game with a new goal: Pick up the late lab report, go catch up with Max, wherever he may have wandered to, and try to give Max the report even though it's late. You'll need to add some additional mechanisms to the Person class and to the GiveActionListener, as well as adding the scroll itself within GackWorld.java. Verify that at the end the lab report thinks Max is its owner, Max thinks the lab report is one of his possessions, and Gack.player no longer thinks the lab report is one of its possessions.

  5. Exercise 14.35: Of course, you can make the game much more interesting by adding additional twists. Implement some that interest you. We give a list of suggestions below but feel free to come up with some of your own. Be sure to describe in English whatever new ideas you introduce.

  6. Exercise 14.42: When a person says something in the Land of Gack, it is "heard" only by the player, in that whatever is said gets displayed. It would be more interesting if other objects within the Land of Gack itself could also hear—and potentially respond to—what was said. That way you could have characters who behaved differently if you said "please," magic portals that opened when you said "open sesame," etc. Note that this is just a suggestion; you don't need to do this.

What you must do

  1. Your programming will focus on Exercises 14.34 and 14.35 above. For 14.35, we will expect you to add at least one class to the class hierarchy which should involve new methods and instance variables. Without this, you will not earn any of the points for an appropriate level of difficulty of your changes.

    When grading the programming part, we will look to see that the classes are well-designed, with methods in the appropriate classes. We will also check that the underlying objects are appropriately modified through the methods. For example, when one person gives a thing to another person, both persons, the thing, and the places they are in are appropriately updated. (Note: the state of the places will only change if the two people are in two different places, which you may or may not allow; if you do allow it, then the state of both places will change.)

    Also, part of your score on this part will be determined by the degree of difficulty of what you are trying to do. This is not to say that what you do should be overly complex. Just that if what you do things that are overly simple, we will not give full credit.

  2. You should describe in your own words what you were trying to accomplish in Exercise 14.35, and put this description in a readme.txt file, which you should put into a documents folder in Project7. This description need not be overly long; however, it will be helpful when grading the project.

  3. You should describe how you tested your new domain classes and the new methods that you added to the existing domain classes (such as the give method in Person). In general, there are two forms of testing: unit testing and integrated testing. The latter would involve running the game, and for this you should summarize how you did this, rather than including a transcript. For unit testing, I recommend that you put a main() method in the domain classes you created or modified (e.g., Person, because of the give method), and then create a few objects to test whether the desired behavior occurred. Descriptions of your testing (unit and integrated) should be in the readme.txt file.

  4. Finally, you should draw an updated version of the class diagram for the domain classes, including associations; the original version is Figure 14.2 on page 546. Your updated version should include both the domain classes I provided and the new ones you have added. (The ones I provided are the 7 classes in the package edu.gac.mcs178.gack.domain, not including TestDomain, which is just for testing). Remember that even the provided Java version differs in some ways from the Scheme original; thus, your diagram would differ from Figure 14.2 even if you didn't add or change any classes. I recommend that you just draw this by hand and hand in the hard-copy.

Gradesheet

We will use this gradesheet when grading your lab.

Submission

Use the procedure described in our instructions on submitting code document to submit your Eclipse project; be sure to include the readme.txt file. You should also hand in the class diagram, which may be done by hand, by the beginning of class on Wednesday 5/18.