X-Git-Url: https://git.sesse.net/?p=remoteglot;a=blobdiff_plain;f=Position.pm;fp=Position.pm;h=b847d101162a51a23d6bd7b5ff758a9a66a98930;hp=90e7c1ccc07f649d66b081cb8e01f0a33cb70622;hb=25b4c5b0537cb335c09c7b1bf4e765c5aa6cf412;hpb=559f0db891b73eaf115d57d26e0fe2376a4a5ed2 diff --git a/Position.pm b/Position.pm index 90e7c1c..b847d10 100644 --- a/Position.pm +++ b/Position.pm @@ -195,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);