| 1 | # Overview # |
| 2 | |
| 3 | Hunt the Wumpus is a text game where the player navigates a cave, avoiding |
| 4 | bottomless pits and super bats, all while shooting arrows at a Wumpus. To play, |
| 5 | type `make run`. |
| 6 | |
| 7 | For those unfamiliar with the history of Hunt the Wumpus, Wikipedia has a nice |
| 8 | article describing gameplay, development and history. |
| 9 | |
| 10 | <https://en.wikipedia.org/wiki/Hunt_the_Wumpus> |
| 11 | |
| 12 | |
| 13 | # Configuration # |
| 14 | |
| 15 | If you want to tweak game settings like the number of rooms, arrows or |
| 16 | obstacles, the file `wump_conf.pvvs` contains all the user-configurable |
| 17 | settings. After editing the file, simply run `make clean run` to experience |
| 18 | the new settings. |
| 19 | |
| 20 | |
| 21 | # Instructions # |
| 22 | |
| 23 | The Wumpus typically lives in a cave of twenty rooms, with each room having |
| 24 | three tunnels connecting it to other rooms in the cavern. Caves may vary, |
| 25 | however, depending on options specified when starting the game. |
| 26 | |
| 27 | The game has the following hazards for intrepid adventurers to wind their |
| 28 | way through: |
| 29 | |
| 30 | - **Pits:** If you fall into one of the bottomless pits, you find yourself |
| 31 | slung back out on the far side of the Earth and in very poor shape to continue |
| 32 | your quest since you're dead. |
| 33 | |
| 34 | - **Bats:** As with any other cave, the Wumpus cave has bats in residence. |
| 35 | These are a bit more potent, however, and if you stumble into one of their |
| 36 | rooms they will rush up and carry you elsewhere in the cave. |
| 37 | |
| 38 | - **Wumpus:** If you happen to walk into the room the Wumpus is in you'll |
| 39 | find that he has quite an appetite for young adventurous humans! Not |
| 40 | recommended. |
| 41 | |
| 42 | The Wumpus, by the way, is not bothered by the hazards since he has sucker |
| 43 | feet and is too big for a bat to lift. If you try to shoot him and miss, |
| 44 | there's also a chance that he'll up and move himself into another cave, |
| 45 | though by nature the Wumpus is a sedentary creature. |
| 46 | |
| 47 | Each turn you may either move or shoot a crooked arrow. Moving is done |
| 48 | simply by specifying `m` for move and the number of the room that you'd |
| 49 | like to move down a tunnel towards. Shooting is done similarly; indicate |
| 50 | that you'd like to shoot one of your magic arrows with an `s` for shoot, |
| 51 | then list a set of connected room numbers through which the deadly shaft |
| 52 | should fly! |
| 53 | |
| 54 | If your path for the arrow is incorrect, however, it will flail about in |
| 55 | the room it can't understand and randomly pick a tunnel to continue |
| 56 | through. You might just end up shooting yourself in the foot if you're |
| 57 | not careful! On the other hand, if you shoot the Wumpus you've WON! |
| 58 | |
| 59 | |
| 60 | # Example # |
| 61 | |
| 62 | vvhitespace/examples/hunt-the-wumpus % make clean run |
| 63 | |
| 64 | Welcome to Hunt the Wumpus! |
| 65 | |
| 66 | Please press 16 keys to seed the RNG. |
| 67 | | |
| 68 | ................ |
| 69 | |
| 70 | Instructions? (y/n) |
| 71 | n |
| 72 | |
| 73 | You're in a cave with 20 rooms and 3 tunnels leading from each room. |
| 74 | There are 2 bats and 2 pits scattered throughout the cave, and your |
| 75 | quiver holds 5 custom super anti-evil Wumpus arrows. Good luck. |
| 76 | |
| 77 | ---------- |
| 78 | |
| 79 | You are in room 14 of the cave and have 5 arrows remaining. |
| 80 | *sniff* (You smell the evil Wumpus nearby!) |
| 81 | This room contains tunnels to the following rooms: 18 11 17 |
| 82 | Move or shoot? (m/s) |
| 83 | m |
| 84 | To which room do you wish to move? |
| 85 | 17 |
| 86 | |
| 87 | ---------- |
| 88 | |
| 89 | You are in room 17 of the cave and have 5 arrows remaining. |
| 90 | *sniff* (You smell the evil Wumpus nearby!) |
| 91 | This room contains tunnels to the following rooms: 4 14 0 |
| 92 | Move or shoot? (m/s) |
| 93 | m |
| 94 | To which room do you wish to move? |
| 95 | 4 |
| 96 | |
| 97 | ---------- |
| 98 | |
| 99 | You are in room 4 of the cave and have 5 arrows remaining. |
| 100 | *sniff* (You smell the evil Wumpus nearby!) |
| 101 | This room contains tunnels to the following rooms: 17 1 7 |
| 102 | Move or shoot? (m/s) |
| 103 | m |
| 104 | To which room do you wish to move? |
| 105 | 17 |
| 106 | |
| 107 | ---------- |
| 108 | |
| 109 | You are in room 17 of the cave and have 5 arrows remaining. |
| 110 | *sniff* (You smell the evil Wumpus nearby!) |
| 111 | This room contains tunnels to the following rooms: 4 14 0 |
| 112 | Move or shoot? (m/s) |
| 113 | s |
| 114 | Through which rooms do you wish to shoot your arrow? |
| 115 | (type 5 room numbers separated by spaces) |
| 116 | 14 18 1 |
| 117 | The arrow sails out of room 17 and enters room 14. |
| 118 | The arrow sails out of room 14 and enters room 18. |
| 119 | The arrow sails out of room 18 and enters room 1. |
| 120 | |
| 121 | *thwock!* *groan* *crash* |
| 122 | A horrible roar fills the cave, and you realize, with a smile, that you |
| 123 | have slain the evil Wumpus and won the game! You don't want to tarry for |
| 124 | long, however, because not only is the Wumpus famous, but the stench of |
| 125 | dead Wumpus is also quite well known, a stench plenty enough to slay the |
| 126 | mightiest adventurer at a single whiff!! |
| 127 | |
| 128 | |
| 129 | # Heap Assignments # |
| 130 | |
| 131 | Game data is stored starting at heap address `0x1000`. A variety of settings |
| 132 | are located here, one per word. |
| 133 | |
| 134 | GAME_DATA = 0x1000 |
| 135 | |
| 136 | GAME_DATA+0 = Number of rooms in cave |
| 137 | GAME_DATA+1 = Number of rooms containing pits |
| 138 | GAME_DATA+2 = Number of rooms containing bats |
| 139 | GAME_DATA+3 = Number of tunnels per room |
| 140 | GAME_DATA+4 = Maximum arrow flight distance |
| 141 | GAME_DATA+5 = Number of arrows |
| 142 | GAME_DATA+6 = Player location |
| 143 | GAME_DATA+7 = Wumpus location |
| 144 | |
| 145 | Room data is stored as an array of structs starting at heap address `0x2000`. |
| 146 | Each room struct has the following layout. |
| 147 | |
| 148 | BASE+0 = bool:contains_pit? (valid options are 0 or 1) |
| 149 | BASE+1 = bool:contains_bat? (valid options are 0 or 1) |
| 150 | BASE+2 = int:connected room (-1 indicates no tunnel, >0 is index of destination room) |
| 151 | ... |
| 152 | BASE+n = int:connected room |
| 153 | |
| 154 | Each struct is `number_of_tunnels_per_room + 2` words in size. Room numbers |
| 155 | begin at `0` and can be used as indices into this room data array. |
| 156 | |
| 157 | The heap space from `0x3000` and up is used as a user input buffer. |