]> git.sesse.net Git - remoteglot/blobdiff - remoteglot.pl
Include the last move in simple (UCI) form in the JSON output.
[remoteglot] / remoteglot.pl
index 39fa629304b429840583dfe22cbe414b25284153..53d5cab390fca0d907ea732639b1924b9a63c832 100755 (executable)
@@ -239,6 +239,7 @@ sub handle_uci {
                                $pos_waiting = undef;
                        }
                } else {
+                       $engine2->{'info'} = {};
                        my $pos = $pos_waiting // $pos_calculating;
                        uciprint($engine2, "position fen " . $pos->{'fen'});
                        uciprint($engine2, "go infinite");
@@ -344,6 +345,11 @@ sub style12_to_pos {
        $pos{'black_castle_q'} = $x[14];
        $pos{'time_to_100move_rule'} = $x[15];
        $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{'fen'} = make_fen(\%pos);