}
}
+my %tbprobe_cache = ();
+
sub complete_using_tbprobe {
my ($pos, $info, $mpv) = @_;
# Run through the PV until we are at a 6-man position.
# TODO: We could in theory only have 5-man data.
my @pv = @{$info->{'pv' . $mpv}};
- my $key = join('', @pv);
+ my $key = $pos->fen() . " " . join('', @pv);
my @moves = ();
- if (exists($pos->{'tbprobe_cache'}{$key})) {
- @moves = @{$pos->{'tbprobe_cache'}{$key}};
+ if (exists($tbprobe_cache{$key})) {
+ @moves = @{$tbprobe_cache{$key}};
} else {
if ($mpv ne '') {
# Force doing at least one move of the PV.
push @moves, $uci_move;
}
- $pos->{'tbprobe_cache'}{$key} = \@moves;
+ $tbprobe_cache{$key} = \@moves;
}
$info->{'pv' . $mpv} = \@moves;
if ($score == 0 && $info->{'tablebase'}) {
return ['d', undef];
} else {
- return ['cp', $score];
+ return ['cp', int($score)];
}
}
}