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