From UBC Wiki

Hunt the Wumpus

Authors: Andrew Bolyachevets, David Karchynski and Trueman Lam

What is the problem?

We will be implementing Hunt the Wumpus game in SWI Prolog. The rules of the game can be found at:

In a nutshell, we are controlling a hunter via text input. At each turn the player can take the following actions:

  • move to an adjacent room
  • shoot an arrow in the direction of the adjacent rooms

The hunter is facing 3 hazards and will be notified of the proximity to each via text output.

In case of a bottomless pit you will 'feel a breeze nearby'. For a colony of bats that will pick you up and drop you in a random space you will 'hear flapping nearby'. For the ultimate danger of wumpus you will smell the unbearable stench.

Some additional rules are:

  • The wumpus is too heavy to be carried by bats and is covered in suckers - he can’t fall down the pit.
  • Shooting an arrow that does not hit the wumpus will startle it.
  • The player has a total of 5 arrows.
  • The player may find an arrow in one of the rooms left behind by another (now dead) hunter.

As Prolog is known for its strength in representing knowledge bases and applications to expert systems, we thought that the labyrinth from Hunt the Wumpus (with deadly dangers lurking around every corner) could be encoded in the spirit of logical programming.

What is the something extra?

For an extra, we intend to use a decahedron for our map, instead of a grid. The decahedron implementation will include a possibility to shoot a curved arrow in mind bending projectiles. The numbering of vertices (aka rooms) in decahedron is randomized in each game instance, so are the locations of two bottomless pits, two bat caves and wumpus.

What did we learn from doing this?

The game we chose was actually quite natural to implement in Prolog, as the state of the world could easily be described in terms of the collection of facts. Game progress was also natural to encode in terms of fact update.

Links to code etc