push @squares, [ $row, $col ];
}
}
+ if (scalar @squares == 0) {
+ die "Impossible move $move";
+ }
if (scalar @squares != 1) {
- die "Ambigious or impossible move $move";
+ die "Ambigious move $move";
}
return (@{$squares[0]}, $to_row, $to_col, $promo);
}
return ($pretty, $nb);
}
+sub num_pieces {
+ my ($board) = @_;
+
+ my $num = 0;
+ for my $row (0..7) {
+ for my $col (0..7) {
+ my $piece = $board->[$row][$col];
+ ++$num if ($piece ne '-');
+ }
+ }
+ return $num;
+}
+
sub _prettyprint_move_no_check_or_mate {
my ($board, $from_row, $from_col, $to_row, $to_col, $promo) = @_;
my $piece = $board->[$from_row][$from_col];