Prog 6: Wumpus

4/8 Changes shown in blue.  4/10 Description of entering 'u' to undo the last move shown in green. 4/18 Arrow can travel at most 3 rooms, not 4, shown in purple.

Welcome to Hunt the Wumpus, a classic game by Gregory Yob from 1972.  

(See a copy of his original write-up, and the Wikipedia page.  Play a text-based copy on-line. See what one version of this program looked like in BASIC.)

The Wumpus lives in a completely dark cave of 20 rooms.  Each room has 3 tunnels leading to other rooms, as indicated in this diagram:

Running the program looks like:

Author: Dale Reed          ______18______

CS 141 Program #6: Wumpus      /      |       \ TA: Elliott Ness, T 6:00 AM     /      _9__      \ April 3, 2016    /      /    \      \ System: XCode on Mac   /      /      \      \                             17     8        10     19 

  |  \   / \      /  \   / |Hunt the Wumpus:   |   \ /   \    /    \ /  |

The Wumpus lives in a       |    7     1---2     11  |

completely dark cave of     |    |    /     \    |   |

20 rooms.  Each room has    |    6—---5     3---12   |

3 tunnels leading to other  |    |     \   /     |   | 

rooms as shown:             |    \       4      /    |

                            |     \      |     /     |

                             \     15---14---13     /

                              \   /            \   /

                               \ /              \ /

                               16---------------20

Hazards:

1. Two rooms have bottomless pits in them.  If you go there you fall and die.

2. Two other rooms have super-bats.  If you go there, the bats grab you and

   fly you to some random room, which could be troublesome.  Then those bats

   go to some random room.

3. The Wumpus is not bothered by the pits or bats, as he has sucker feet and

   is too heavy for a bat to lift.  Usually he is asleep.  Two things wake

   him up: Anytime you shoot an arrow, or you entering his room.  When he  

   wakes he moves one room 75% of the time, staying still the other 25% of   

   the time. After that, if he is in your room, he eats you and you die!

Moves:

On each move you can:

1. Move into an adjacent room.  To move enter 'M' followed by a space and

   then a room number.  

2. Shoot your guided arrow through a list of three adjacent rooms, which 

   you specify.  Your arrow ends up in the final room. If an arrow

   can't go a direction because there is no connecting tunnel, it ricochets

   and moves to a randomly selected adjacent room and continues

   doing this until it has traveled 3 rooms in total.  If the arrow  

   hits the Wumpus, you win! If the arrow hits you, you lose. You 

   automatically pick up an arrow if you go through a room with an arrow in  

   it. To shoot enter 'S' followed by a list of up to 3 adjacent room numbers 

   separated by spaces.

3. Undo your last move by entering 'U'

Good luck!

1. You are in room 20. Tunnels lead to 13 16 19

   Your move: m 13

2. You are in room 13. Tunnels lead to 12 14 20

   There is:  a smell  a draft

   Your move: M 10

   That move is invalid.  Please retry

   Your move: M 20

3. You are in room 20. Tunnels lead to 13 16 19

   Your move: s 13 14 4 

Wumpus just got whomped. You win!

Exiting...

Implementation Points (55 total):

Turnin Instructions:

Turnin your on-time submission in Blackboard into the Program 6: Wumpus Assignment.  Late submissions must be turned in to the Program 6: Late Assignment.  Since this is at the end of the semester, note that you do not get an extra full week to turn in a late version.

Extra Credit 

Extra Credit can only be earned if all other aspects of the game are working and it is turned in on time.  Turn in your extra-credit submission into Blackboard into the Program 6: Extra Credit Assignment. You may choose one or the other of the options below, but not both.