#!/usr/bin/perl use strict; my $xcord=0; my $ycord=0; my $end=0; print "You find yourself in a castle hall...\n"; until ($end eq 1) { print "Which way do you want to go? (F, R, B, L) "; my $dir=; chop ($dir); if ($dir eq "F") { $ycord=$ycord+1; print "You move Forward..\n"; } if ($dir eq "R") { $xcord=$xcord+1; print "You move Right..\n"; } if ($dir eq "B") { $ycord=$ycord-1; print "You move Backwards..\n"; } if ($dir eq "L") { $xcord=$xcord-1; print "You move Left..\n"; } print "Position: ($xcord, $ycord)\n"; if (($xcord eq 0) and ($ycord eq 1)) { print "You move into the dark passageway.\n"; print "OMG YOU SEE SKULLS ON PIKES!\n"; print "F, B\n"; print "There's still a little ways to go..\n"; } if (($xcord eq 0) and ($ycord eq 2)) { print "You walk up to a wall, and find a passage to the left.\n"; print "L, B\n"; } if (($xcord eq -1) and ($ycord eq 2)) { print "You walk left through the passage, and see a faint ray of light.\n"; print "L, R\n"; } if (($xcord eq -2) and ($ycord eq 2)) { print "You continue through the passage, finding a wall and a turn to the right.\n"; print "F, R\n"; } if (($xcord eq -2) and ($ycord eq 3)) { print "You walk towards the growing light, and find yourself outside.\n"; print "Good job!.\n"; my $end=1; exit(); } }