From: Steinar H. Gunderson Date: Tue, 26 Jun 2007 13:11:55 +0000 (+0200) Subject: Don't output values if we don't have them; fixes warnings. X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=bcffafb86e0031ae396e41c36c041be56f0d74a1 Don't output values if we don't have them; fixes warnings. --- diff --git a/remoteglot.pl b/remoteglot.pl index 454cc32..bcc123c 100644 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -390,16 +390,24 @@ sub output_screen { if (defined($uciinfo{'score_mate'})) { printf " Mate in %d\n", $uciinfo{'score_mate'}; } else { - my $score = $uciinfo{'score_cp'} * 0.01; - if ($ficsinfo{'toplay'} eq 'B') { - $score = -$score; + if (exists($uciinfo{'score_cp'})) { + my $score = $uciinfo{'score_cp'} * 0.01; + if ($ficsinfo{'toplay'} eq 'B') { + $score = -$score; + } + printf " Score: %+5.2f\n", $score; } - printf " Score: %+5.2f\n", $score; } - print " PV: ", join(', ', prettyprint_pv($ficsinfo{'board'}, @{$uciinfo{'pv'}})); - print "\n"; - printf " %u nodes, %7u nodes/sec, depth %u ply", - $uciinfo{'nodes'}, $uciinfo{'nps'}, $uciinfo{'depth'}; + + if (exists($ficsinfo{'board'})) { + print " PV: ", join(', ', prettyprint_pv($ficsinfo{'board'}, @{$uciinfo{'pv'}})); + print "\n"; + } + + if (exists($uciinfo{'nodes'}) && exists($uciinfo{'nps'}) && exists($uciinfo{'depth'})) { + printf " %u nodes, %7u nodes/sec, depth %u ply", + $uciinfo{'nodes'}, $uciinfo{'nps'}, $uciinfo{'depth'}; + } if (exists($uciinfo{'tbhits'})) { printf ", %u Nalimov hits", $uciinfo{'tbhits'}; }