]> git.sesse.net Git - remoteglot/blobdiff - remoteglot.pl
Improve the tbhits output a bit, in particular wrt. singular form.
[remoteglot] / remoteglot.pl
index 8c871084ead93aca57e599d80e1a98aaaf927a8b..16a4f8dc6b2f6e9b0b6918451ef3f7d531847c11 100755 (executable)
@@ -18,7 +18,7 @@ use warnings;
 
 # Configuration
 my $server = "freechess.org";
-my $target = "22";
+my $target = "224";
 # my $engine = "/usr/games/toga2";
 my $engine = "wine Rybkav2.3.2a.mp.w32.exe";
 my $telltarget = undef;   # undef to be silent
@@ -374,6 +374,8 @@ sub style12_to_fen {
        $fen .= $x[26];
 
        $pos{'fen'} = $fen;
+       $pos{'move_num'} = $x[26];
+       $pos{'last_move'} = $x[29];
 
        return \%pos;
 }
@@ -566,12 +568,22 @@ sub output_screen {
                return;
        }
 
-       my $text = '';
+       my $text = 'Analysis';
+       if ($pos_calculating->{'last_move'} ne 'none') {
+               if ($pos_calculating->{'toplay'} eq 'W') {
+                       $text .= sprintf ' after %u. ... %s', ($pos_calculating->{'move_num'}-1), $pos_calculating->{'last_move'};
+               } else {
+                       $text .= sprintf ' after %u. %s', $pos_calculating->{'move_num'}, $pos_calculating->{'last_move'};
+               }
+               if (exists($uciid{'name'})) {
+                       $text .= ',';
+               }
+       }
 
        if (exists($uciid{'name'})) {
-               $text .= "Analysis by $uciid{'name'}:\n\n";
+               $text .= " by $uciid{'name'}:\n\n";
        } else {
-               $text .= "Analysis:\n\n";
+               $text .= ":\n\n";
        }
 
        return unless (exists($pos_calculating->{'board'}));
@@ -598,8 +610,12 @@ sub output_screen {
                        $text .= "  ($score)" if (defined($score));
 
                        my $tbhits = '';
-                       if (exists($uciinfo{'tbhits' . $mpv})) {
-                               $tbhits = sprintf ", %u tbhits", $uciinfo{'tbhits' . $mpv};
+                       if (exists($uciinfo{'tbhits' . $mpv}) && $uciinfo{'tbhits' . $mpv} > 0) {
+                               if ($uciinfo{'tbhits' . $mpv} == 1) {
+                                       $tbhits = ", 1 tbhit";
+                               } else {
+                                       $tbhits = sprintf ", %u tbhits", $uciinfo{'tbhits' . $mpv};
+                               }
                        }
 
                        if (exists($uciinfo{'nodes' . $mpv}) && exists($uciinfo{'nps' . $mpv}) && exists($uciinfo{'depth' . $mpv})) {
@@ -623,8 +639,12 @@ sub output_screen {
                        $text .= sprintf "  %u nodes, %7u nodes/sec, depth %u ply",
                                $uciinfo{'nodes'}, $uciinfo{'nps'}, $uciinfo{'depth'};
                }
-               if (exists($uciinfo{'tbhits'})) {
-                       $text .= sprintf ", %u Nalimov hits", $uciinfo{'tbhits'};
+               if (exists($uciinfo{'tbhits'}) && $uciinfo{'tbhits'} > 0) {
+                       if ($uciinfo{'tbhits'} == 1) {
+                               $text .= ", one Nalimov hit";
+                       } else {
+                               $text .= sprintf ", %u Nalimov hits", $uciinfo{'tbhits'};
+                       }
                }
                if (exists($uciinfo{'seldepth'})) {
                        $text .= sprintf " (%u selective)", $uciinfo{'seldepth'};