From: Steinar H. Gunderson Date: Tue, 12 May 2015 23:03:43 +0000 (+0200) Subject: When a position comes in with the same position but new result, copy the result over... X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=46280f671364dbc49270404d6c5b4c45d5ac59f7;hp=e9516524af69bdf7bf09c4b530abd04f82c7626e When a position comes in with the same position but new result, copy the result over instead of throwing away the entire position. --- diff --git a/remoteglot.pl b/remoteglot.pl index 9c2130c..86c4474 100755 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -328,13 +328,19 @@ sub handle_position { my ($pos) = @_; find_clock_start($pos); - # if this is already in the queue, ignore it - return if (defined($pos_waiting) && $pos->fen() eq $pos_waiting->fen()); + # if this is already in the queue, ignore it (just update the result) + if (defined($pos_waiting) && $pos->fen() eq $pos_waiting->fen()) { + $pos_waiting->{'result'} = $pos->{'result'}; + return; + } # if we're already chewing on this and there's nothing else in the queue, # also ignore it - return if (!defined($pos_waiting) && defined($pos_calculating) && - $pos->fen() eq $pos_calculating->fen()); + if (!defined($pos_waiting) && defined($pos_calculating) && + $pos->fen() eq $pos_calculating->fen()) { + $pos_calculating->{'result'} = $pos->{'result'}; + return; + } # if we're already thinking on something, stop and wait for the engine # to approve