HW05: Text Adventure

Create a “text adventure” game, e.g., like Zork.

Because each person may create his/her own unique game, there is no test script. Just upload to bitbucket as usual.

Avoid all memory leaks. Check with valgrind.

We’ll figure out an object-oriented design in class, and those details will be posted here.


  • Create at least 10 “rooms” with descriptions and various exits
  • Support at least two players, who switch turns; create only one Player class to represent a single player, and create two objects (instances) for the two players
  • Create a simple parser that interprets text commands like “go north” or “get lamp”
  • Some rooms must have items, which may be picked up by the player
  • Keep track of the player’s inventory (items the player has picked up) and support a command “inventory” which shows this inventory
  • Create another class representing non-player characters (e.g., monsters) that move around the rooms autonomously
  • Somehow list the monsters that are in the same room as the player (perhaps the player has to type a command to see this list)
  • Support basic combat, e.g., use an item to attack a monster and reduce hit points

CSCI 221 material by Joshua Eckroth is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Source code for this website available at GitHub.