You are to add two new puzzles, each with at least one (probably only one) special class extending Room. Your puzzles should, in total, involve at least two new command words (don't forget to add them to CommandWords.java!!). I moved the creation of the maze of Rooms to its own class RoomMaker; this way you will likely not have to make any changes to the Game class itself. You will also have to make minor changes to RoomMaker to patch your new rooms into the game. Do not change the basic Game/Room interface without speaking with me.
I am providing two versions. The standard one we've been using is zuul4.0; the Room interface here has response(),etc taking the inventory as second parameter. The alternative version, zuul4.0p, introduces Player class to hold all player-specific information (at this time, really only the inventory); the second parameter in the Room interface is thus Player. You can use either version.
Another recent change is that I moved the creation of the maze of Rooms to its own class, RoomMaker. This way, you will likely not have to make any changes to the Game class itself.
Team Option: You may pair up with a classmate and do your project together. In that case, you should have three new puzzle rooms, and at least four new command words.
In either case, you are to add enough plain Rooms, and enough corresponding descriptions,
to produce a playable game. Your new rooms should follow a reasonably
sensible "map". The RoomMaker link method provides an easy way simultaneously to create both links between two rooms: eg
link(dragonAnteRoom, "north", dragonRoom, "south")
would create the linkage of Example 3, below.
You will be graded in part on the inventiveness and originality of your puzzles. Adding a subclass of Item (as in the Locked Room example, #1 below) is not required, but can sometimes lead to cleverer puzzles. Here are a few possible examples:
1. Different flavor of Locked room. The command UNLOCK DOOR works only if you have the CORRECT key in your inventory. You define a class Key extends Item {...}. Keys have some kind of (numeric) attribute that allows the game to determine whether a key is correct, though the number isn't visible to the player. (A simpler version where you have to give the command UNLOCK DOOR but any KEY will work is also acceptable.) Brownie points for printing (when appropriate) "you do have a key, but not, alas, the correct key".
2. Room with heavy stone. The commands are MOVE STONE, EAT COOKIE. Sample play transcript:
You have entered a room with a huge stone in the center.
It looks like it might be covering something.
MOVE STONE
You are too weak and hungry to move the stone.
EAT COOKIE
Wow! That made you feel stronger!
MOVE STONE
Filled with a burst of strength, you move the stone.
A moneybag is revealed.
3. Dragon's room, from which escape is blocked
until you defeat or befriend the dragon.
Note the "advance warning" in the outline below that, well, you'll need
to find the SWORD first.
Note also (you don't necessarily have to implement this) that in this
transcript not only does the behavior of the DragonRoom change when you
kill the dragon, but also the behavior of the anteroom immediately
SOUTH (because "A dragon's roar splits the air" is no longer printed!).
GO NORTH
The passage is littered with bones. A dragon's roar splits the air.
I hope you have a weapon!
<<... go back and GET SWORD...>>
GO NORTH
The passage is littered with bones. A dragon's roar splits the air.
I hope you have a weapon!
GO NORTH
You have entered the lair of the dragon. His tail flicks behind you
and the exit door latches closed.
GO SOUTH
the dragon won't let you out!
ATTACK DRAGON
The dragon is injured!
ATTACK DRAGON
The dragon dies!
GO SOUTH
The passage is littered with bones.
GO NORTH
You have entered the lair of the dragon.
His dead body lies before you.
Exits: south north
GO NORTH
You have entered the dragon's treasury
4. Buried treasure
GO EAST
You are on a sandy beach. An X is drawn on the sand.
DIG
You don't have a shovel
<< go back and GET SHOVEL..>>
GO EAST
You are on a sandy beach. An X is drawn on the sand.
DIG
A locked treasure chest is revealed!
TAKE CHEST
You can't take that!
UNLOCK CHEST
You don't have the key ...
<< go back and GET KEY..>>
UNLOCK CHEST
A necklace is revealed; it appears to be made of diamonds.
TAKE NECKLACE
5. Taking an exam. You have to study and eat first, though! Note that the studying (and eating)
is done in the hallway here. Both hallway and examroom are "special",
but with a little thought they can be the same class (as in the ValveRoom example).
This is probably the hardest puzzle illustrated here.
GO NORTH
You have entered a classroom. An exam is about to begin.
TAKE EXAM
Are you sure? You haven't studied and you're too hungry.
GO SOUTH
You're in the hall by your locker. The following things are here: BOOK SANDWICH
READ BOOK
Kant's _Categorical Imperative_ is dense reading, but finally you get what he is saying.
EAT SANDWICH
You are happy and content
GO NORTH
You have entered a classroom. An exam is about to begin.
TAKE EXAM
Wow! You get an A! The professor gives you a gold_star
Email me your completed project.