]> git.sesse.net Git - remoteglot/commitdiff
Print more friendly mate information.
authorSteinar H. Gunderson <sesse@debian.org>
Thu, 28 Jun 2007 19:40:34 +0000 (21:40 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Thu, 28 Jun 2007 19:40:34 +0000 (21:40 +0200)
remoteglot.pl

index c960bb247f63bf0744ebeee477567867715ba325..f6a94028ef2d4ac1d65705f20ed08261bd86b46d 100755 (executable)
@@ -441,7 +441,15 @@ sub output_screen {
        } else {
                # single-PV
                if (defined($uciinfo{'score_mate'})) {
-                       printf "  Mate in %d\n", $uciinfo{'score_mate'};
+                       my $mate = $uciinfo{'score_mate'};
+                       if ($ficsinfo{'toplay'} eq 'B') {
+                               $mate = -$mate;
+                       }
+                       if ($mate > 0) {
+                               printf "  White mates in %u\n", $mate;
+                       } else {
+                               printf "  Black mates in %u\n", -$mate;
+                       }
                } else {
                        if (exists($uciinfo{'score_cp'})) {
                                my $score = $uciinfo{'score_cp'} * 0.01;