]> git.sesse.net Git - remoteglot/blobdiff - Position.pm
Fix a display bug on empty PV.
[remoteglot] / Position.pm
index 6b772a67b82fafe4bcffb5b44a09849a8fb49eeb..b847d101162a51a23d6bd7b5ff758a9a66a98930 100644 (file)
@@ -127,6 +127,11 @@ sub parse_pretty_move {
        return $pos->{'board'}->parse_pretty_move($move, $pos->{'toplay'});
 }
 
+sub num_pieces {
+       my ($pos) = @_;
+       return $pos->{'board'}->num_pieces();
+}
+
 # Returns a new Position object.
 sub make_move {
         my ($pos, $from_row, $from_col, $to_row, $to_col, $promo) = @_;
@@ -190,6 +195,16 @@ sub make_move {
        return bless $np;
 }
 
+# Returns a new Position object, and the parsed UCI move.
+sub make_pretty_move {
+       my ($pos, $move) = @_;
+
+       my ($from_row, $from_col, $to_row, $to_col, $promo) = $pos->parse_pretty_move($move);
+       my $uci_move = Board::move_to_uci_notation($from_row, $from_col, $to_row, $to_col, $promo);
+       $pos = $pos->make_move($from_row, $from_col, $to_row, $to_col, $promo);
+       return ($pos, $uci_move);
+}
+
 sub _pos_to_square {
         my ($row, $col) = @_;
         return sprintf("%c%d", ord('a') + $col, 8 - $row);