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 c960bb2..f6a9402 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;