Fix 7-man tablebase mate length.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 16 Nov 2014 18:33:28 +0000 (19:33 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 16 Nov 2014 18:33:28 +0000 (19:33 +0100)
remoteglot.pl

index f383bb6..675ef50 100755 (executable)
@@ -511,7 +511,7 @@ sub output {
 
                my $t = $tb_cache{$fen};
                my $pv = $t->{'pv'};
-               my $matelen = int((1 + scalar @$pv) / 2);
+               my $matelen = int((1 + $t->{'score'}) / 2);
                if ($t->{'result'} eq '1/2-1/2') {
                        $info->{'score_cp'} = 0;
                } elsif ($t->{'result'} eq '1-0') {
@@ -946,7 +946,8 @@ sub handle_tb_lookup_return {
                                }
                                $tb_cache{$fen} = {
                                        result => $pgn->result,
-                                       pv => \@uci_moves
+                                       pv => \@uci_moves,
+                                       score => $response->{'Response'}{'Score'},
                                };
                                output();
                        }