This task has been flagged for clarification. Code on this page in its current state may be flagged incorrect once this task has been clarified. See this page's Talk page for discussion.
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 they run out of arrows before killing the Wumpus, the player 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 he 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.

exits = [[1,4,7], [0,2,9], [1,3,11], [2,4,13], [0,3,5],
  [4,6,14], [5,7,16], [0,6,8], [7,9,17], [1,8,10],
  [9,11,18], [2,10,12], [11,13,19], [3,12,14], [5,13,15],
  [14,16,19], [6,15,17], [8,16,18], [10,17,19], [12,15,18]]
hazard = [null] * 20
emptyRoom = function()
	while true
		room = floor(rnd * 20)
		if not hazard[room] then return room
	end while
end function
for i in range(1, 2)
	hazard[emptyRoom] = "bat"
	hazard[emptyRoom] = "pit"
end for
hazard[emptyRoom] = "wumpus"
 
print "*** HUNT THE WUMPUS ***"
print "-----------------------"
curRoom = emptyRoom
arrows = 5
 
checkWumpus = function()
	if hazard[curRoom] == "wumpus" then
		print "You find yourself face to face with the wumpus."
		print "It eats you whole."
		print "GAME OVER"; exit
	end if	
end function
 
while true
	print "You are in room " + curRoom + "."
	checkWumpus
	for r in exits[curRoom]
		if hazard[r] == "wumpus" then print "You smell something terrible nearby."
		if hazard[r] == "bat" then print "You hear a rustling."
		if hazard[r] == "pit" then print "You feel a cold wind blowing from a nearby cavern."
	end for
	print "Tunnels lead to: " + exits[curRoom].join(", ")
	print "You have " + arrows + " arrows."; print
	while true
		m = input("M)ove, S)hoot, or Q)uit? ").lower
		if m == "q" then exit
		if m != "m" and m != "s" then continue
		target = input("Which room? ").val
		if exits[curRoom].indexOf(target) == null then
			print "Cannot get there from here."
		else if m == "m" then
			curRoom = target
			if hazard[curRoom] == "bat" then
				print "You have entered the lair of a giant bat."
				curRoom = emptyRoom
				print "It picks you up and drops you in room " + curRoom + "."
			else if hazard[curRoom] == "pit" then
				print "The ground gives way beneath your feet."
				print "You fall into a deep abyss."
				print "GAME OVER"; exit
			end if
		else
			arrows = arrows - 1
			if hazard[target] == "wumpus" then
				print "Congratulations!  You shot the wumpus!"
				exit
			end if
			print "You missed."
			if rnd < 0.75 then
				print "The wumpus wakes from his slumber."
				hazard[hazard.indexOf("wumpus")] = null
				hazard[emptyRoom] = "wumpus"
				checkWumpus
			end if
			if arrows == 0 then
				print "As you grasp at your empty quiver, "
				print "you hear a large beast approaching..."
				hazard[curRoom] = "wumpus"
				checkWumpus
			end if
		end if
		break
	end while
end while