X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=Position.pm;h=9868b218e6c4e2b74b5d2a21eeb8623d849d1295;hb=2ec5e8902926f0e192fb119f3955dab2564816aa;hp=371e179b8139d9541b85d874917cbc1255ee1768;hpb=aab426550a1da4daea35eb0b0691fe8bd7907348;p=remoteglot diff --git a/Position.pm b/Position.pm index 371e179..9868b21 100644 --- a/Position.pm +++ b/Position.pm @@ -29,6 +29,11 @@ sub new { $pos->{'player_w'} =~ s/^W?[FCIG]M//; $pos->{'player_b'} =~ s/^W?[FCIG]M//; $pos->{'move_num'} = $x[26]; + if ($x[27] =~ /([a-h][1-8])-([a-h][1-8])/) { + $pos->{'last_move_uci'} = $1 . $2; + } else { + $pos->{'last_move_uci'} = undef; + } $pos->{'last_move'} = $x[29]; bless $pos, $class; @@ -179,6 +184,8 @@ sub make_move { $np->{'player_b'} = $pos->{'player_b'}; my ($move, $nb) = $pos->{'board'}->prettyprint_move($from_row, $from_col, $to_row, $to_col, $promo); $np->{'last_move'} = $move; + $np->{'last_move_uci'} = Board::move_to_uci_notation($from_row, $from_col, $to_row, $to_col, $promo); + return bless $np; }