The Game

Hunt the Wumpus was an early computer game. The basic goal of the game is to kill a wumpus in a cave without entering the chamber the wumpus is in, using your senses to detect when it is close by. Along the way you can fall into pits, be picked up by bats, and discover objects such as arrows and treasure.

Atari had a full version of this that you can play online, but this has far more features than we want you to try to implement. A simpler version that is closer to what you should implement is available here. However, your solution must be character based. For example, your program might look like

Action: N)orth, S)outh, E)ast, W)est, shoot A)rrow, H)elp, Q)uit: e

You hear flapping. You smell something bad.
Action: N)orth, S)outh, E)ast, W)est, shoot A)rrow, H)elp, Q)uit: s

You find an arrow. You smell something bad.
Action: N)orth, S)outh, E)ast, W)est, shoot A)rrow, H)elp, Q)uit: n

You hear flapping. You smell something bad.
Action: N)orth, S)outh, E)ast, W)est, shoot A)rrow, H)elp, Q)uit: n

You are in a maze of twisty passages, all alike.
Action: N)orth, S)outh, E)ast, W)est, shoot A)rrow, H)elp, Q)uit: e

You feel a breeze. You smell something bad.
Action: N)orth, S)outh, E)ast, W)est, shoot A)rrow, H)elp, Q)uit: s

You were eaten by a wumpus!

You will work in groups of 2 or 3 on this assignment. You will design your own version of the game and implement it in C++. One of your early tasks will be to document the rules of your game and to construct a class model. Part of your grade will be based on how creative your solution is; you might hunt moldy food in your fridge, chase Roscoe Raider through the science building, or be hunted by a large cockroach. Be creative with behaviors as well: alternative traps and new ways to move about the caves are also appropriate. Note that just substituting (say) marshmallows for arrows is not an example of creativity.

The Game

  • You must have a help option describing how to play the game. Ensure this covers all rules.
  • The game must be reasonably simple. In particular, it must be possible to play the game without extensive research.
  • At a minimum, you must have equivalents for the wumpus, the pits, the bats, and the arrows (something to pick up). Since you must use inheritance in the implementation (see below), you will probably want at least two types of hazards or weapons (such as two types of traps or two types of weapons).
  • No graphics. All user input and output to your program must be through cin, cout, and cerr using the standard ASCII character set.
  • The map must have a reasonable size. With the standard rules, a map of 6 rooms by 6 rooms is enough to exhibit good game play. If you do have a larger map, you must justify it on your lab 1 submission.
  • Stick to one level. Multi-level dungeons are too hard for instructors to test.
  • Use e/w/n/s to move in the specified directions. Entering an "e" should move east; do not have the user enter more complex commands such as "m" for move followed by an "e"; the "e" is enough by itself. Uniformity is critical for grading. Upper case commands must be treated the same as lower case commands (case in-sensitive). Do not implement the common "wasd" directions - this game is intended for casual gamers.
  • The program cannot quit because of an invalid command. Print an error and continue.
  • Your game must exhibit random behavior. Randomly place items on the map so the user has to solve a different map each time. You can use rand to generate the random numbers. Your game maps must be randomly generated.
  • Provide a debug mode that can be used to illustrate that your program works. The debug mode must have a pre-generated map with a full collection of the different types of objects you have implemented, placed to show that these objects work as intended.
  • Along with the e/w/n/s, actions to pick up weapons, etc., have "d" (or something similar) display the full map on demand. This will help with debugging and grading. Use the following key for this map: a period for an empty room, an - for a weapon (such as an arrow), + or P for the player, B for a bat, @ for a hazard (such as a pit), ? for treasure, and ! for the monster. As an example, your map would look like
. . - + .
. B @ . -
. ? . - B
. @ ! . .
@ . . - @
  • Follow this notation for your own game, though you might use a different symbol than B for alternative bat-like entities. Having uniform notation on this output will help tremendously in grading. How you display this information is up to you - for instance, you might use d for "dump" - but be sure it is obvious to the user. This will help both when debugging and demonstrating that your solution works. You can disable this later if you distribute the game for profit.
  • While dumping the map can be useful to verify game play is working, it must be possible to win the game without resorting to viewing the map. This means you must implement clues similar to the "you smell a wumpus" clue of the classical game. In addition, the monster and other items must not move during game play unless there is a specific rule such as "the wumpus moves when shot at".
  • Whenever you create an instance of a class your group writes, or whenever you pass an instance as a parameter, use pointers. This is especially important for inheritance, but it is also necessary to give your team more experience with pointers. Do not worry about writing destructors or using the delete operator.

Design Constraints

  • Your solution must be unique. If it looks like one of the hundreds of versions of the game that are available online, you will be penalized. Ignore the other code and you will be fine.
  • You must use inheritance in an important way as part of your solution. One use of inheritance is adequate (that is, one base class with two distinct subclasses with important different behaviors), but for an A you may need additional base classes with additional subclasses.
  • You must make heavy use of classes (have a number of them). This actually helps distinguish your solution from most of the ones online.
  • Use pointers for domain objects like the map, locations, arrows, etc.
  • You might use a standard design pattern, other than singleton, as discussed in SE 2811. This is another way to show creativity.
  • Each class must have clear responsibilities.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.