Handouts:
Syllabus
Assignment #1
Class Notes, Chapter 15
Game source code
Notes about ``The Game''
Review Questions:
struct x *p = malloc(sizeof(struct x *));
Exercises:
1. Get the initial version of the game (as handed out in class) to compile and run. It should print a ``?'' prompt, and you should be able to type the ``n'', ``s'', ``e'', and ``w'' commands to attempt to move around, and the ``take'' and ``drop'' commands to pick up and drop objects. (There are one or two other commands, which you can learn by studying the file commands.c.)
Study and understand as much of the source code of the game as you can.
2. Add a ``help'' command which prints a message listing the available verbs (or at least the most common ones).
3. Add a ``long description'' field to the object and room structures. (It can either be an array of char or a pointer to char.) Modify the initializations of the objects and rooms arrays in main.c to initialize the description field for some or all objects and rooms. Arrange that the ``look'' command print the long description of the current room (if it has one), and that the description is also printed when the actor enters a new room. Add an ``examine'' command which prints the long description of an object, if it has one. (Otherwise, have it print ``You see nothing special about the %s.'')
This page by Steve Summit // Copyright 1995-9 // mail feedback