Assignment 9: Adventure Game
Fall 2007, David Matuszek

Purposes of this assignment:

General idea of the assignment:

Write a text adventure game. If you have no idea what I'm talking about, go to www.ifiction.org and play around for awhile.

Most adventure games use commands of two or more words. We're going to use a GUI.

Details:

The game itself:

An adventure game consists of:

Your assignment is to write a small adventure game. By "small" I mean somewhere between four and twelve rooms, and four to eight objects; at least two of the objects should have some "use" relevant to the game. Each partner should do some rooms and some objects. The theme of the game, and the goal of the game, is up to you.

So that your adventure game is not too difficult to grade, please:

The GUI:

You also need to write a Swing GUI to allow a person to play the game. Although there is only one GUI, I would like each partner to write all the code (creating the components, laying them out, attaching listeners) for part of the GUI. For that reason, I'm dividing the GUI up into four "areas" (where each area is a JPanel), as follows:

The above division of the GUI is suggested, not required. You can rearrange things as necessary to create a good-looking GUI, but each partner should do all the work for a JComboBox, some JButtons, and a text component.

Separation of concerns:

The classes for the game itself should not do any input/output; in particular, they should not use the GUI in any way. The game should not even "know" the GUI exists. Instead, the GUI should use the classes and methods of the game.

I am providing a sample game, McGame.zip. This is a very simple game where the main class (McGame) uses the classes and methods of the game, and does all the (text-only) input/output; the game does not "know" who is calling it. However, McGame is not perfectly designed; the McGame class does all the room creation and setup, etc., and this should be done in a model class. Ideally, the main class should be general enough to play any text adventure game, without knowing any of the details of the game.

Notes:

In the last assignment (Battleship II) you had to switch between two GUIs. This assignment is somewhat simpler, since you have only a single GUI, and the structure of that GUI doesn't change. You will be enabling and disabling buttons, putting things into and removing things from combo boxes, and writing text, but you lay out the components once and don't change them.

In this assignment, the user talks to the program by clicking buttons, choosing items from a combo box, etc., but never has to type anything. The program responds by displaying text in text components. It doesn't display pictures, only text.

Due date:

Thursday, November 15, before midnight. Turn in your program electronically, using Blackboard. (See my Instructions for Using Zip Files and Blackboard). Only assignments submitted via Blackboard will be accepted--do not send your program by email. The usual late penalty of 5 points per day (out of 100 points) will apply.