CS 535 Object-Oriented Programming and Design

Fall Semester, 2008

Mini Adventure

Assignment Index

© 2008, All Rights Reserved, SDSU & Roger Whitney

 San Diego State University -- This page last updated 10/30/08

Mini Adventure

Adventure, sometimes called Colossal Cave Adventure, is an old computer game played on ASCII terminals. Mini-adventure will be a similar but smaller game. A single player explores a maze of rooms and corridors. The goal is to collect all the gold and return it to one location.

Rooms & Corridors

Rooms can be of various sizes, but are all rectangular: k by n units. Each room has a label so the user can know when they return to the same room. A room can have any number of doors. The doors in a room are labeled "A", "B", "C", etc.. Each side of a door can have different labels. A door connects a room to another room or corridor. Some of the doors are stuck and can only be opened with an axe. Trolls can not open a closed door. A player can close a door with a magic potion, which stays with the door until opened. However a magic potion can only be use to close two doors before it is used up. If a door connects two rooms, the two rooms must be physically adjacent. A corridor connects two rooms, which do not have to be physically adjacent. For example, a corridor could connect GMCS 308 to the library’s computer lab. Corridors can be of different lengths, but are all one unit wide. The length of a corridor does not have to follow Euclidean space constraints. The corridor connecting GMCS 327 and GMCS 324 could be 10 units long, while a corridor connecting GMCS 308 and the library’s computer lab could be 5 units long. Each time the game is started it uses the same configuration of rooms and corridors read from a file.

Gold, Potions, Axes and Trolls

Distributed in the maze of rooms and corridors are pieces of gold, magic potions, axes and trolls. In future versions of the game other types of items will be added. Gold pieces, magic potions, axes and trolls are randomly distributed in the rooms and corridors at the start of the game. The number of each is configurable to make different levels of play. A player can pick up pieces of gold, axes and magic potions. A player can only hold 5 different items at a time. Each magic potion, each axe and each gold piece counts as one item. Trolls are attracted to piles of gold. A pile of gold is two or more pieces of gold in one location. If you leave a pile of gold unprotected, trolls will be drawn to the pile. Protect a pile of gold by leaving a magic potion with the gold. An unprotected pile of gold will attract trolls in any room or corridor adjacent to the room or corridor containing the pile of gold. A room is adjacent to a corridor if the room is connected to the corridor. A room is adjacent to another room if the two rooms are connected directly or connected by a corridor. If a troll touches an unprotected pile of gold, it disappears. Once the player leaves the room/corridor containing an unprotected pile of gold, any troll in an adjacent room/corridor will move to the pile of gold and touch it. Every time a player moves in or out of a room or corridor all trolls move to a random adjacent room or corridor. However if a troll is near an unprotected pile of gold it will move toward it. If a troll enters a room with an axe it will pick it up. If while holding gold the player enters a room containing an troll holding an axe, the troll will throw the axe at the player. If the player is holding a potion the player is moved to a random room and loses the potion. If the player does not have a potion the player dies 50% of the time. The other 50% of the time the player is stunned and the troll with steal the players  gold. The troll will run in random directions and with 25% probability drop a piece of gold in each room it enters. However if a player enters a room carrying an axe it can throw it at any troll in the room and kill the troll. This destroys the axe.

Moving Around

When in a room or a corridor, a player can use the command "view" to get a description of the room and it contents. A sample interaction is:

Player> view

Response> You are in room "Spooky". The room contains two pieces of gold, one troll, and two doors, A and B.

A player can move to an item with the moveTo command.

Player> moveTo gold

The moveTo command can take a modifier. The modifier can be either the name of the item or the words "near" or "far". Examples are:

Player> moveTo near gold

Player> moveTo B door

If a modifier is not given and more than one option is possible, the modifier near is assumed. When you are at a door, the command "exit" brings the player though the door into the next room/corridor. The player can not pass a troll in a corridor, as corridors are too narrow.

Picking Up/Dropping

The command pickUp x will pick up item x if the player is next to item x. The command drop x will drop on of item x if the player is holding at lease one of item x.


The player can throw things. The syntax is throw X at Y. Where  X can be any of gold, magic potion or axe. Y can be any of gold, magic potion, axe, troll or door. The player can not throw something it is not holding.

Future Extensions

The following will be added in future versions of the game:

Different type of rooms

Different types of magic potions

Other creatures will be added


The game does not display a map of the game layout. The game is purely an ASCII game. The player types in legal commands, and the game prints the response.

More about Adventure

If you wish to learn more about the original game Adventure see http://en.wikipedia.org/wiki/Colossal_Cave_Adventure .