Hunt the Wumpus: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with "{{task|Games}}Create a simple implementation of the classic textual game [http://en.wikipedia.org/wiki/Hunt_the_Wumpus Hunt The Wumpus]. The rules are: The game is set in a c...")
 
m (Fixed typos)
Line 1: Line 1:
{{task|Games}}Create a simple implementation of the classic textual game [http://en.wikipedia.org/wiki/Hunt_the_Wumpus Hunt The Wumpus]. The rules are:
{{task|Games}}Create a simple implementation of the classic textual game [http://en.wikipedia.org/wiki/Hunt_the_Wumpus Hunt The Wumpus].


The rules are:
The game is set in a cava that consists of a 20 room labyrinth. Each room is connected with other 3 (the cave is modeled after the vertices of dodecahedron). The objective od the player is to find and kill the horrendous beat Wumpus that lurks in the cave.


The game is set in a cave that consists of a 20 room labyrinth.
The player has 5 arrows. If he runs out of arrows before killing the Wumpus, the players loses the game.
Each room is connected to 3 other rooms (the cave is modeled after the
In the cave there are:
vertices of a dodecahedron).
The objective of the player is to find and kill the horrendous beast Wumpus that lurks in the cave.


The player has 5 arrows.
If he runs out of arrows before killing the Wumpus, the players loses the game.

In the cave there are:
* One Wumpus
* One Wumpus
* Two giant bats
* Two giant bats
Line 18: Line 24:
Each turn the player can either walk into an adjacent room or shoot into an adjacent room.
Each turn the player can either walk into an adjacent room or shoot into an adjacent room.


Whenever the player enters a room, he "senses" what happens in adjacent rooms. The messages are:
Whenever the player enters a room, he "senses" what happens in adjacent rooms.
The messages are:


* Nearby Wumpus: "You smell something terrible nearby."
* Nearby Wumpus: "You smell something terrible nearby."
Line 24: Line 31:
* Nearby pit: "You feel a cold wind blowing from a nearby cavern."
* Nearby pit: "You feel a cold wind blowing from a nearby cavern."


When the player shoot, he wins the game if he is shooting in the room with the Wumpus. If if shoots in another room, the Wumpus has 75% of chance of waking up and moving into an adjacent room: if this is the room with the player, he eats hum up and the game is lost.
When the player shoots, he wins the game if he is shooting in the room with the Wumpus.
If if shoots into another room, the Wumpus has a 75% of chance of waking up and moving into an adjacent room: if this is the room with the player, he eats him up and the game is lost.


=={{header|Javascript}}==
=={{header|Javascript}}==

Revision as of 11:43, 7 May 2015

Task
Hunt the Wumpus
You are encouraged to solve this task according to the task description, using any language you may know.

Create a simple implementation of the classic textual game Hunt The Wumpus.

The rules are:

The game is set in a cave that consists of a 20 room labyrinth. Each room is connected to 3 other rooms (the cave is modeled after the vertices of a dodecahedron). The objective of the player is to find and kill the horrendous beast Wumpus that lurks in the cave.

The player has 5 arrows. If he runs out of arrows before killing the Wumpus, the players loses the game.

In the cave there are:

  • One Wumpus
  • Two giant bats
  • Two bottomless pits

If the player enters a room with the Wumpus, he is eaten by it and the game is lost.

If the player enters a room with a bottomless pit, he falls into it and the game is lost.

If the player enters a room with a giant bat, the bat takes him and transports him into a random empty room.

Each turn the player can either walk into an adjacent room or shoot into an adjacent room.

Whenever the player enters a room, he "senses" what happens in adjacent rooms. The messages are:

  • Nearby Wumpus: "You smell something terrible nearby."
  • Nearby bat: "You hear a rustling."
  • Nearby pit: "You feel a cold wind blowing from a nearby cavern."

When the player shoots, he wins the game if he is shooting in the room with the Wumpus. If if shoots into another room, the Wumpus has a 75% of chance of waking up and moving into an adjacent room: if this is the room with the player, he eats him up and the game is lost.

JavaScript

See Hunt_The_Wumpus/Javascript.