]> git.sesse.net Git - remoteglot/blobdiff - remoteglot.pl
Fix some score sign issues. (These things are so easy to mess up.)
[remoteglot] / remoteglot.pl
index 2ebffc89f355eda4a33acc270c58e34907e8c592..fc812976ef7b6cf79cedf9ac1a66515bedef7dc7 100755 (executable)
@@ -736,6 +736,9 @@ sub output_screen {
                        $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";
@@ -743,9 +746,6 @@ sub output_screen {
                                $text .= sprintf ", %u Nalimov hits", $info->{'tbhits'};
                        }
                }
-               if (exists($info->{'seldepth'})) {
-                       $text .= sprintf " (%u selective)", $info->{'seldepth'};
-               }
                $text .= "\n\n";
        }
 
@@ -1130,11 +1130,6 @@ sub short_score {
 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});
@@ -1144,9 +1139,6 @@ sub score_sort_key {
        } else {
                if (exists($info->{'score_cp' . $mpv})) {
                        my $score = $info->{'score_cp' . $mpv};
-                       if ($score == 0) {
-                               return " 0.00";
-                       }
                        if ($invert) {
                                $score = -$score;
                        }
@@ -1348,7 +1340,7 @@ sub give_new_move_to_second_engine {
                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;
                }