Seventh Assignment
Due Tuesday 30th April
Electronic Submission
Write a text-based adventure game. For a sample, log in to rabbit
and type this command: ~sratbag/game (note the wiggle
at the beginning). Your
game is not supposed to be exactly like this, which is just
a simple demonstration to give you the idea. You can make the game
be whatever you like. There are a number of requirements for how the programming
is done, but very few requirements for how the game should play.
To see the text file that defines the artificial world used
by the demonstration program, follow this link
Requirements
- A (simulated) little man/woman/robot/whatever should move around in an artificial
world, under the control of a user
- Every time the robot moves to a different location, the program should print
a description of that new location, together with any objects it contains.
- The robot should be able to pick up objects in the current location
(perhaps with weight limits) and put down objects in the current location.
- When the robot moves to a new location, whatever it is carrying
of course goes with it.
- You should be able to put an object in a location, go away, come back
later, and find the object still there (unless it has moved for some
good, extra-credit, reason).
- There should be no practical limit on the number of locations, the number
of objects, or the number of objects in any location.
- The entire artificial world should be completely defined by a text file.
If somebody wants to completely change the world, they should only have to
change the text file that describes it. There must be no need ever to edit
the program.
- To a certain extent, how you implement the game is up to you. Of course
you must use good programming techniques, and it would be a good idea to
make use of some of the things we have been studying in class (this assignment
is designed to benefit from such things).
- You must define class/struct/object types to represent locations
and objects. When the program starts up it should read the text file,
create all the appropriate objects in memory, and start accepting commands.
Ideally, if there is anything wrong in the textfile, it should be reported as
an error.
Extra Credit Possibilities (some easy-ish, some difficult)
- Do something clever with the programming.
- When the user exits from the game allow (perhaps as an option) the text file
to be overwritten with the current state of the game, so that next time it is played
everything starts up from where you left off (objects in locations, etc)
- Implement Monsters: objects that move around and do things all on their own,
perhaps attacking the robot, perhaps moving objects when nobody is looking.
- Make there be some goal to the game, so that plyers can win, or keep a "high score".
- Make the descriptions that are printed seem natural, like well-written
prose, adapted to conditions.
- Implement windows (that can be seen through, but not walked through), and/or doors
(that can be opened or closed and locaked or unlocked)
- etc, etc, etc.