Assignment

In the (loose) spirit of the Colossal Cave Adventure and Zork, you will create a game program that prompts the player for commands and responds with text descriptions. You can use any language or OS you choose.

The Commands

Your game should respond to the following 1-word commands:

Command Action
n, s, e, w Move through an unlocked door to the next room to the north, south, east, or west respectively.
get Pick up an object. If the player is already holding another item, print a message and exchange the items.
use Use an item as the key to unlock a door if the key fits one of the doors in the room. When used, the item should disappear and the door should remain unlocked
item Describe the item the player is holding.
look Re-print long descriptions

Components

Your game code should use dense arrays of component classes to manage the game data:

Use component existence as for boolean state. So a door is locked if there is an item in the DoorID to ItemID lock map, and unlocked if there's no item for that door in the lock map.

Data

You only need to initialize enough data to pick up a key, move to a second room, use the key, and move to a final room.

691 students

Read initialization data from one or more files.

Submission

Edit "assn3/README.txt" to describe your test computer (at least OS and CPU), what language and compiler you used, and how to build and run your project. Give a cheat script for what commands to use to go through to pick up a key, unlock a door, and move through it. Also include anything interesting we should know about your game and implementation.