Comp 271 Lab 6 - The World of Zuul

Your job here is to make use of polymorphism to add some additional puzzle rooms to the World of Zuul game, contained in zuul.zip. The main() method is in file Game.java. See the polymorphism notes for an explanation of how the classes work.

You are to modify the game program presented in class, adding the features below. Every new command should have a "generic" response; ie be recognized by Room.response(). That is, TURN VALVE in a non-ValveRoom should say "There is nothing to turn here!" 

You may do this project in teams or individually. If you do this individually, you should create two new puzzle rooms. Generally, with a team of N you should create 2*N new puzzle rooms, though there is some room for variation.

You will be graded to an extent on the cleverness of your puzzles. For this project, the design of interesting puzzles tends to be harder than the implementation. If you're trying to implement a puzzle and getting stuck, try revisiting the design to see if it can be altered in a way that preserves the spirit but is easier to implement. Or contact me.

Additions

Your revised game should include the following features:

0. Add the required number (above) of puzzle-room classes. For each puzzle-room class, you should also add appropriate ordinary Room instances, Item instances and new CommandWords as needed. Each puzzle room should, in general, involve at least one new CommandWord, one new Item, one new subclass of Room, and (in most cases) some kind of "state change" to the new room (eg the valve is now turned, the wand is now found) (this does not apply to all rooms, eg the LockedRoom).

1. At least one of your puzzle rooms should have a feature where you cannot leave the room until some action occurs; this is somewhat like SerpentRoom except that there you could leave (GO EAST) in another direction. Possibilities are: 

You have to FIGHT the dragon (with a SWORD?)
You have to GIVE the dragon a PRESENT or COOKIE.
There is a cave-in and you have to DIG (with SHOVEL?)

It is a good idea to give the player some kind of hint, before entry, as to what they will need.

You can allow the player to explore other (further-in) rooms, but the player should not be allowed to loop back by another route to bypass the blocked direction.

2. Add a new subclass to Item, and a puzzle room (included in the list above) where this new subclass is used in a nontrivial way (that is, at some point the state of the subclass object should matter). For example, you could add a subclass Edible, so the command

    EAT STUFF

works (everywhere) as long as STUFF is Edible. At this point you can add a specific edible, Chocolate, that makes you stronger:

There is a large stone in the middle of the room.
MOVE STONE
You are too weak to move the stone. Perhaps if you had more energy...
EAT CHOCOLATE
You feel much stronger!
MOVE STONE
A box_of_jewels is now visible underneath where the stone lay.

(This scenario takes place in a StoneRoom class.) The CHOCOLATE should go away after you eat it. Bonus: have it go away after you EAT CHOCOLATE twice, which means that the Edible class must contain a field counting the number of bites remaining. (It also means that, after the first EAT CHOCOLATE, the game should say something like "you feel a little bit stronger; keep eating!")

Another option is to create a Key subclass to Item. Keys have "key numbers" in them; different keys are used to unlock different things. If you are in the LockedRoom and try to go through the locked exit carrying a key that is not the correct key, the message is "Hm, the door seems to be locked, and you don't have the correct key". Later on, in another room, perhaps a command is UNLOCK CHEST; again, if you don't have the right key, you can't open it.

Keys with different key numbers can either have the same name (all "key") or different names ("door_key", "magic_key", etc). The first approach makes the game more "interesting"!

Here are a few more puzzle possibilities.

UNLOCK CHEST with a KEY found elsewhere; once the chest is unlocked, something should be inside. The chest key should ideally not be the same one used to open the door of LockedRoom.

There is a place where you have to DIG. You can only DIG if you have the SHOVEL. If you DIG, some treasure is uncovered.
 
Cross a rickety two-move bridge over a bottomless pit; if you carry too much the bridge will break; you can only carry two things at a time (or else no more than 10 weight units at a time). (Can you find a way to give the user a hint that they are carrying too much? How about:

GO NORTH
The bridge starts creaking wildly and is about to break       
GO NORTH
The bridge broke! You are dead

(starting over)

GO NORTH
The bridge starts creaking wildly and is about to break       
GO SOUTH
You are standing at the south end of a swaying bridge....
DROP SWORD
The sword is dropped
GO NORTH
The bridge creaks but seems to be holding
GO NORTH
You are standing at the north end of a swaying bridge...

In other words, the bridge consists of two Rooms, one doing the weight-checking and one doing the breaking)

 
You need to CAST SPELL in the WizardsChamber, but in order to do this you must first find in the game a BELL, BOOK, and CANDLE. (And maybe LIGHT CANDLE? Or maybe, in the simpler direction, just find NEWTEYE and BATWING. If you try to CAST SPELL and don't have the ingredients, the game should tell you what you're missing.)

Add an ending to the game: a room that you can only enter if you have collected one or more designated Items and, once you enter, the game is finished.