use strict;
use warnings;
my $pos = 0;
print "\n";
for (my $i = 0; $i < 10; $i++) {
my $x = int(rand(7)) - 3;
print "- " . ($i + 1) . "回目 : ";
if ($x > 0) {
print "$x進む";
}
elsif ($x < 0) {
print "$x戻る";
}
else {
print "そのまま";
}
$pos += $x;
print " : 現在位置 ";
if ($pos > 0) {
print "前に$pos";
}
elsif ($pos < 0) {
print "後ろに$pos";
}
else {
print "スタート";
}
print "
\n";
}
print "
\n";