$text .= sprintf " %u nodes, %7u nodes/sec, depth %u ply",
$info->{'nodes'}, $info->{'nps'}, $info->{'depth'};
}
+ if (exists($info->{'seldepth'})) {
+ $text .= sprintf " (%u selective)", $info->{'seldepth'};
+ }
if (exists($info->{'tbhits'}) && $info->{'tbhits'} > 0) {
if ($info->{'tbhits'} == 1) {
$text .= ", one Nalimov hit";
$text .= sprintf ", %u Nalimov hits", $info->{'tbhits'};
}
}
- if (exists($info->{'seldepth'})) {
- $text .= sprintf " (%u selective)", $info->{'seldepth'};
- }
$text .= "\n\n";
}
sub score_sort_key {
my ($info, $pos, $mpv, $invert) = @_;
- $invert //= 0;
- if ($pos->{'toplay'} eq 'B') {
- $invert = !$invert;
- }
-
if (defined($info->{'score_mate' . $mpv})) {
if ($invert) {
return -(99999 - $info->{'score_mate' . $mpv});
} else {
if (exists($info->{'score_cp' . $mpv})) {
my $score = $info->{'score_cp' . $mpv};
- if ($score == 0) {
- return " 0.00";
- }
if ($invert) {
$score = -$score;
}
my $this = $refutation_moves{$move};
if ($this->{'depth'} < $best->{'depth'} ||
- ($this->{'depth'} == $best->{'depth'} && $this->{'score_cp'} < $best->{'score_cp'})) {
+ ($this->{'depth'} == $best->{'depth'} && score_sort_key($this, $pos, '', 1) > score_sort_key($best, $pos, '', 1))) {
$best_move = $move;
next;
}