rendered paste bodysub error
{
for (@_) {
print $_;
my @splitline = split(/ *\| */,$_);
print @splitline;
pop @splitline; shift @splitline;
unless (pop @splitline eq 'error') {exit;}
print 'When ';
if ($splitline[0] eq 'Y' && print 'target is North, ') {}
elsif ($splitline[0] eq 'N' && print 'target is South, ') {}
if ($splitline[1] eq 'Y' && print 'target is East, ') {}
elsif ($splitline[1] eq 'N' && print 'target is West, ') {}
my %dirs = (2,'ahead',3,'behind',4,'left',5,'right');
for (keys %dirs) {
if ($splitline[$_] ne '-' && print 'wall is ', $dirs{$_}, ',') {}
}
print " then the test fails.\n";
}
}sub error
{
for (@_) {
print $_;
my @splitline = split(/ *\| */,$_);
print @splitline;
pop @splitline; shift @splitline;
unless (pop @splitline eq 'error') {exit;}
print 'When ';
if ($splitline[0] eq 'Y' && print 'target is North, ') {}
elsif ($splitline[0] eq 'N' && print 'target is South, ') {}
if ($splitline[1] eq 'Y' && print 'target is East, ') {}
elsif ($splitline[1] eq 'N' && print 'target is West, ') {}
my %dirs = (2,'ahead',3,'behind',4,'left',5,'right');
for (keys %dirs) {
if ($splitline[$_] ne '-' && print 'wall is ', $dirs{$_}, ',') {}
}
print " then the test fails.\n";
}
}