}
}
+ for (0 .. 2) {
+ my $line = $lines[$_][$player];
+ my $start;
+ my $lasty;
+ for (my $i = 1; $i <= $#$line; $i++) {
+ defined $line->[$i] or next;
+ if ($line->[$i][1] == $line->[$i - 1][1]) {
+ $start = $i unless defined $start;
+ } elsif (defined $start) {
+ delete @$line[$start .. $i-2];
+ undef $start;
+ }
+ }
+ delete @$line[$start .. $#$line-2] if defined $start; # or -1
+ }
+
$player++;
}