Overview of the Adventure Game

The Adventure game you will implement for this project–like any of the text-based adventure games that were the dominant genre before the advent of more sophisticated graphical adventures like the Myst series–takes place in a virtual world in which you, as the player, move about from one location to another. The locations, which are traditionally called rooms even though they may be outside, are described to you through a written textual description that gives you a sense of the geography. You move about in the game by giving commands, most of which are simply an indication of the direction of the motion. For example, in the classic Adventure game developed by Willie Crowther, you might move about as follows:

In the console sessions shown in this guide, user input appears in uppercase so that it is easier to see. Your program should ignore case distinctions in executing commands.

In this example, you started outside the building, followed the road up the hill by typing WEST, and arrived at a new room on the top of the hill. Having no obvious places to go once you got there, you typed EAST to head back to where you started. As is typical in such games, the complete description of a location appears only the first time you enter it. The second time you come to the building, the program displays a much shorter identifying tag, although you can get the complete description by typing LOOK, as follows:

From here, you might decide to go inside the building by typing IN, which brings you to another room, as follows:

In addition to the new room description, the inside of the building reveals that the Adventure game also contains items: there is a set of keys here. You can pick up the keys by using the TAKE command, which requires that you specify what item you are taking, like so:

The keys will, as it turns out, enable you to get through a grating at the bottom of the streambed that opens the door to Colossal Cave and the magic it contains.

The best model for the Adventure project is the teaching machine example that appears in Chapter 12. The starting repository for Project 5 includes the code for the teaching machine so that you can copy and adapt whatever parts of the code you think will be useful. The repository also includes the tokenscanner library, the various data files described later in this handout, and the following template files for the adventure game: