X-Git-Url: https://git.sesse.net/?p=remoteglot;a=blobdiff_plain;f=Position.pm;h=1a02d61d86f28626aff845546b79ddbde6e487c5;hp=371e179b8139d9541b85d874917cbc1255ee1768;hb=7314c1611dbab18a6ebdd5934697dd5cf94ed437;hpb=74d7aba567761212303524b6db6284e3a13a6a6a diff --git a/Position.pm b/Position.pm index 371e179..1a02d61 100644 --- a/Position.pm +++ b/Position.pm @@ -29,7 +29,13 @@ 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]; + $pos->{'prettyprint_cache'} = {}; bless $pos, $class; return $pos; @@ -179,6 +185,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; }