Interpreter and Compiler Project

Hunt the Wumpus

In 1973, Gregory Yob was dissatisfied with grid-based games like Hunt the Hurkle and Mugwump. So he wrote Hunt the Wumpus, whose aim - to hunt some creature - is the same but whose mechanics are very different. For the Wumpus is hidden in a network of caves. Each cave is linked by passages to three others, and the whole network is shaped like a dodecahedron, the corners being the caves and the edges the passageways between them. Luckily, this shape can be accurately squashed flat, so that maps can be drawn.

These caves are more dangerous than the grid worlds of Hunt the Hurkle and Mugwump, for various reasons. Instead of just pointing at locations, the player is actually in the caves with the Wumpus, and the Wumpus is hungry. The player must move around from cave to cave, and there are obstacles: two bottomless pits which the player can fall into and die, and two giant bats which can lift the player, carry them around and drop them in another cave - which might contain the aforementioned hungry Wumpus or bottomless pits. If the player blunders into the Wumpus, there is a chance that the startled Wumpus will run away to an adjacent cave, and a chance that instead the Wumpus might eat the player. Luckily the game gives clues to the player about what can be heard and smelt from adjacent caves, so these hazards do not occur without warning.

The player starts in a random location and is given the numbers of three adjacent caves. There will be clues about hazards that are nearby, but the game doesn't say exactly where they are so a player must tread carefully. In each turn the player may move to one of the adjacent caves. Alternatively, the player can shoot a "crooked arrow" if they suspect that they can hit the Wumpus with it. There are five of these arrows, each because they are crooked they can fly around corners - a single arrow may travel through up to five rooms, chosen by the player as the arrow flies. If the arrow hits the Wumpus, the game is won; if not, then the Wumpus is startled and runs - possibly into the tasty-looking player.

Strategy involves carefully moving from cave to cave, mapping out the network. If there are hazards in unknown adjacent caves, it is best to retreat to safety and try to find another way around until the exact location of the hazard has been pinpointed and can be plotted with certainty on a map. Once the location of the Wumpus has been pinpointed with certainty, it's time to fire an arrow.

Hunt the Wumpus would be much easier to write if Tiny BASIC had arrays to keep track of what's in the twenty caves and what paths exist between them. But Tiny BASIC has no arrays, and the code of Hunt the Wumpus shows various ways of getting around that. Since hazards are fewer than locations, a handful of variables keeps track of them. The paths between locations are calculated as and when needed using a subroutine at line 200. That subroutine looks at a variable P (for position), into which can be copied the location of the player or the wumpus as needed.

This game bridges the gap between simple hunt games like Hunt the Hurkle and Mugwump, and true adventure games where the player explores a game world with monsters and treasure. It can therefore be used as a starting point for more detailed adventures, especially if you combine it with procedural generation as used in Intergalactic Space Rescue to add variety to the map locations.

Filename: wumpus.bas.

Next: Tic-tac-toe


New Comment

Yes No