Project 3: A Much, Much Better Zuul

Modified from an assignment by the authors

Due: Friday, April 11 at 11:59 pm.

Your assignment is to create a game based on Zuul, the game described in chapter 7.  I would suggest you start with either zuul-better or one of the enumerated type versions (discussed towards the end of the chapter).

First, you should decide what the goal of your game is. It should be something along the lines of: You have to find some items and take them to a certain room (or a certain person?). Then you can get another item. If you take that to another room, you win.  


For example: You are at Xavier University. You have to find out where your lab class is. To find this, you have to find the registrar and ask. At the end, you need to find the exam room. If you get there on time, and you have found your textbook somewhere along the way, and you have also been to lecture class, then you win. And if you’ve been to Ryan’s Pub more than five times during the game, your exam score is halved.

Or: You are lost in a dungeon. You meet a dwarf. If you find something to eat that you can give to the dwarf, then the dwarf tells you where to find a magic wand. If you use the magic wand in the big cave, the exit opens, you get out and win.

It can be anything, really. Think about the scenery you want to use (a dungeon, a city, a building, etc) and decide what your locations (rooms) are. Make it interesting, but don’t make it too complicated. (I would suggest no more than 15 rooms.)  Put objects in the scenery, maybe people, monsters, etc. Decide what task the player has to master.

D-level functionality (correctness)

At this level, you have to implement your scenario with the following functionality:

  • The game has several locations/rooms.
  • At minimum, rooms can have up to 4 exits (east, west, south, north).
  • The player can walk through the locations. (This was already implemented in the code you were given.)
  • There are items in some rooms. Every room can hold any number of items.  Some items can be picked up and some cannot.

C-level functionality (correctness)

D-level with the following modifications:

  • The player can carry some items. Every item has a weight. The player can carry items only up to a certain total weight.
  • The player can win. There has to be some situation (of reasonable complexity) that is recognized as the end of the game where the player is informed that he/she has won.
  • Implement a command “back” that takes you back to the last room you’ve been in.  

·        Add at least four new commands (in addition to those that were present in the code in zuul-better).

B-level functionality (correctness)

C-level plus the following:

·        The initial game setup is read from a file.  The file contains lines of three types:

o       room name description – where name is a one-word unique name for the room and description is a string that describes the room

o       exit room1 direction room2 -  where room1 is the name of a room, direction is a one-word direction, and room2 is the name of the room that is connected by that exit from room1

o       item name weight location – where name is a one-word item name, weight is the item weight and location is the name of the room where the item is initially located

·        As each line is read, the correct method is called to set up the appropriate initial game state.  You need to include error checking for the input (for example: does the room already exist?) with some output to the player if there is a problem.  Hint: Consider using a HashMap to store the rooms in the game by their names.

A-level functionality

To the B-level functionality, add at least two additional features.  The features should be non-trivial and should indicate some effort. If you have an idea and are not sure, clear it with me first.  Ideas include:

  • Add characters to your game. Characters are people or animals or monsters -- anything that moves, really. Characters are also in rooms (like the player and the items). Unlike items, characters can move around by themselves.  The characters should interact with the player in some way, even if it is just speaking to the player when the room is entered.
  • Extend the parser to recognize three-word commands. You could, for example, have a command

give bread dwarf

      to give some bread (which you are carrying) to the dwarf.

  • Add a magic transporter room --  every time you enter it you are transported to a random room in your game.
  • Make the game multi-player.
  • Add a beamer (see exercise 7.44).

Creativity and cleverness will also be considered when considering whether the A level has been reached.

Notes on Style

See the style guide posted on our web site. Approximately 30 percent of your project grade will be based on coding style, including documentation. Generally I will divide this into an assessment of

  • documentation -- the comments and specifications for your code.
  • naming -- quality names that make your code more self-documenting.
  • code structure -- the structuring of the code itself: line and method lengths, indentation, whitespace, clarity of code, efficiency of code. (Efficiency is not a big concern early on.)  Do consider cohesion, coupling, and encapsulation in your design.  Reading chapter 7 before beginning the project will help in learning about these concepts.

Deliverables -- what should you hand in?

  • Each time you work, please complete an entry in this electronic journal. The log is intended to help you and I analyze your behavior over time -- noticing where you spend time or have problems, and to help me give you advice on your process as well. You will not lose points for what may seem to be questionable practices, but you will lose points for not providing the log.
  • Your code.

The handin name for this project is project3. It will be due at 23:59 Friday, April 11. When you hand it in, please handin the entire directory for project3. Copy the files to a directory called project3 on cerebro and then, from the directory above project3, type:

handin 180 project3 project3/*

Check the syllabus for a discussion of academic honesty. This project must be your own work.