]> git.sesse.net Git - remoteglot/blobdiff - remoteglot.pl
Fix 0.00 showing for long_score, too.
[remoteglot] / remoteglot.pl
index 2f38f8ac61b8ed7ab3f7b931171950be8b9fdec1..c65c7e8a29fdafa8106a6e8610a3126be39c34f2 100755 (executable)
@@ -188,6 +188,7 @@ while (1) {
        if ($nfound > 0 && vec($rout, fileno($engine->{'read'}), 1) == 1) {
                my @lines = read_lines($engine);
                for my $line (@lines) {
+                       next if $line =~ /(upper|lower)bound/;
                        handle_uci($engine, $line, 1);
                }
                $sleep = 0;
@@ -197,6 +198,7 @@ while (1) {
        if ($nfound > 0 && vec($rout, fileno($engine2->{'read'}), 1) == 1) {
                my @lines = read_lines($engine2);
                for my $line (@lines) {
+                       next if $line =~ /(upper|lower)bound/;
                        handle_uci($engine2, $line, 0);
                }
                $sleep = 0;
@@ -239,7 +241,7 @@ sub handle_uci {
                } else {
                        if (defined($move_calculating_second_engine)) { 
                                my $move = $refutation_moves{$move_calculating_second_engine};
-                               $move->{'pv'} = $engine->{'info'}{'pv'};
+                               $move->{'pv'} = $engine->{'info'}{'pv'} // $engine->{'info'}{'pv1'};
                                $move->{'score_cp'} = $engine->{'info'}{'score_cp'} // $engine->{'info'}{'score_cp1'} // 0;
                                $move->{'score_mate'} = $engine->{'info'}{'score_mate'} // $engine->{'info'}{'score_mate1'};
                                $move->{'toplay'} = $pos_calculating->{'toplay'};
@@ -682,7 +684,7 @@ sub output_screen {
        #
        if (exists($info->{'pv1'}) && !exists($info->{'pv2'})) {
                for my $key (qw(pv score_cp score_mate nodes nps depth seldepth tbhits)) {
-                       if (exists($info->{$key . '1'}) && !exists($info->{$key})) {
+                       if (exists($info->{$key . '1'})) {
                                $info->{$key} = $info->{$key . '1'};
                        }
                }
@@ -1056,6 +1058,9 @@ sub short_score {
        } else {
                if (exists($info->{'score_cp' . $mpv})) {
                        my $score = $info->{'score_cp' . $mpv} * 0.01;
+                       if ($score == 0) {
+                               return " 0.00";
+                       }
                        if ($invert) {
                                $score = -$score;
                        }
@@ -1083,6 +1088,9 @@ 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;
                        }