Prog #6: Wumpus Solution

$30.00

Description

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):

  1. (6 points) Implementing the cave system, allowing making moves from room to room.  Note you can implement this using arrays, linked lists, or whatever way makes sense to you.  No points will be awarded for this program unless you can at least make moves throughout all the rooms.  Attempting to move to an invalid room gives an error message and allows the user to retry.

  2. (5 points) Initializing the game to have the Wumpus in some random room. the bottomless pits in two other rooms, and super-bats in two other rooms.   These 5 rooms with hazards must all be distinct from one another.  Place the person into an initial random room that contains no hazards.

  3. (5 points) Implementing super-bats dropping you into a random room, then relocating to some random room.

  4. (9 points) As you move through the maze, as you enter each room you should always indicate:

    1. A smell if this room is next to the Wumpus room

    2. A draft if this room is next to a room with a pit

    3. A flapping sound if this room is next to a room with bats.

  5. (5 points) Entering ‘c’ for “cheat” prints out the move number, room number location of the Wumpus, the pits and the bats, location of arrow.

  6. (10 points) Implementing shooting guided arrow

  7. (15 points) Implement the ability to undo moves, being able to undo all the way back to the beginning of the game.  Enter ‘U’ to undo a move. Undoing a move resets the location of the Wumpus and your location to what they were on the previous move, as well as resetting whether or not you have an arrow, if any were fired on that move.  Attempting to undo a move at the beginning of the game results in an error message, allowing you to retry the move.

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 CreditAssignment. You may choose one or the other of the options below, but not both.  

  • (up to 10 points) Make ASCII animated splash screens for the beginning of the game, when you kill the Wumpus, and when you die trying.  To do this print the contents of the screen, then clear the screen (system(“clear”); on UNIX, system(“cls”); on Windows), then print another slightly different screen, and so on. (See samples of Star Wars, and an amazingly artistic dance, and see this recap of a book on how Victorian stenographers started typewriter art, or this rolling donut)

  • (up to 10 points) Implement your program with a graphical user interface, using some graphics package.  Here is one done with Javascript, though it has a different board and slightly different rules.