X-Git-Url: https://git.sesse.net/?p=remoteglot;a=blobdiff_plain;f=Position.pm;h=2e368f29fbbf7d8110edcc9c91472dc1821e5ae9;hp=b847d101162a51a23d6bd7b5ff758a9a66a98930;hb=b0e52191ac0f53984ebfc1176571ddda19542de7;hpb=25b4c5b0537cb335c09c7b1bf4e765c5aa6cf412 diff --git a/Position.pm b/Position.pm index b847d10..2e368f2 100644 --- a/Position.pm +++ b/Position.pm @@ -28,6 +28,8 @@ sub new { $pos->{'player_b'} = $x[18]; $pos->{'player_w'} =~ s/^W?[FCIG]M//; $pos->{'player_b'} =~ s/^W?[FCIG]M//; + $pos->{'white_clock'} = $x[24]; + $pos->{'black_clock'} = $x[25]; $pos->{'move_num'} = $x[26]; if ($x[27] =~ /([a-h][1-8])-([a-h][1-8])/) { $pos->{'last_move_uci'} = $1 . $2; @@ -112,7 +114,14 @@ sub fen { sub to_json_hash { my $pos = shift; - my $json = { %$pos, board => undef, prettyprint_cache => undef, fen => $pos->fen() }; + my $json = { %$pos, fen => $pos->fen() }; + delete $json->{'board'}; + delete $json->{'prettyprint_cache'}; + delete $json->{'black_castle_k'}; + delete $json->{'black_castle_q'}; + delete $json->{'white_castle_k'}; + delete $json->{'white_castle_q'}; + delete $json->{'time_since_100move_rule_reset'}; if ($json->{'player_w'} =~ /^base64:(.*)$/) { $json->{'player_w'} = MIME::Base64::decode_base64($1); }