Maze Game: Sample Program
0404.pl - faulty!
#!/usr/bin/perl
use strict;
require Term::Screen;
my (to student: list your variables here)
#
# Substitute your own variable names into this code
#
# Prepare a new terminal screen
$silly_var=new Term::Screen;
$silly_var->clrscr();
# Get the contents of the map file
open (MF, "< maze04.map");
@the_map_that_was_in_the_file_on_disk = <MF>;
close (MF);
# Force the fracking lines into the the_actual_maze_that_i_will_use mit einer kleiner shosen hornen
@the_actual_maze_that_i_will_use="";
foreach $l (@the_map_that_was_in_the_file_on_disk) {
push @the_actual_maze_that_i_will_use, [$l];
}
# Who's got my little man. Give me back my little man. Gimme, gimme, gimme back my man in the corner
for ($y=0;$y<=20;$y++) {
for ($x=0;$x<=40;$x++) {
$silly_var->at($y,$x)->puts("$the_actual_maze_that_i_will_use[$y][$x]");
if ($the_actual_maze_that_i_will_use[$y][$x] == "@") {
$thar_she_blows_left=$x;
$thar_she_blows_down=$y;
}
}
}
$silly_var->at($y+1,0)->puts("Player is at Y: $thar_she_blows_down X: $thar_she_blows_left");
$silly_var->at($y+2,0)->puts("");
Last updated: 20120225-13:26