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.

#!/usr/bin/perl
 
use strict; # see https://rosettacode.org/wiki/Hunt_the_Wumpus
use warnings;
use List::Util qw( shuffle );
$| = 1;
 
my %tunnels = qw(A BKT B ACL C BDM D CEN E DFO F EGP G FHQ H GIR I HJS
  J IKT K AJL L BKM M CLN N DMO O ENP P FOQ Q GPR R HQS S IRT T AJS);
my ($you, $wumpus, $bat1, $bat2, $pit1, $pit2) = shuffle keys %tunnels;
my $arrows = 5;
print "\nTo shoot, enter a 's' and upper case letter of the desired tunnel.
To move, just enter the upper case letter of the desired tunnel.\n";
 
while( 1 )
  {
  my @adj = split //, my $adj = $tunnels{$you};
  print "\nYou are in room $you and see three tunnels: @adj\n";
  $adj =~ /$bat1|$bat2/ and print "You hear a rustling.\n";
  $adj =~ /$pit1|$pit2/ and
    print "You feel a cold wind blowing from a nearby cavern.\n";
  $adj =~ $wumpus and print "You smell something terrible nearby.\n";
  print "(m)ove or (s)hoot (tunnel) : ";
  defined($_ = <>) or exit;
  if( /s.*([$adj])/ ) # shoot
    {
    $1 eq $wumpus and exit !print "\nYou killed the Wumpus and won the game.\n";
    $wumpus = substr $wumpus . $tunnels{$wumpus}, rand 4, 1;
    $wumpus eq $you and die "\nYou were eaten by a Wumpus and lost the game.\n";
    --$arrows or die "\nYou ran out of arrows and lost the game.\n";
    }
  elsif( /([$adj])/ ) # move
    {
    $you = $1;
    $wumpus eq $you and die "\nYou were eaten by a Wumpus and lost the game.\n";
    "$pit1$pit2" =~ $you and
      die "\nYou fell into a bottomless pit and lost the game.\n";
    "$bat1$bat2" =~ $you and (($you) = shuffle
      grep !/$you|$wumpus|$pit1|$pit2|$bat1|$bat2/, keys %tunnels),
      print "\nA giant bat has carried you to room $you.\n";
    }
  else { print "I don't understand :(\n"; }
  }