+ } else {
+ #
+ # Some programs _always_ report MultiPV, even with only one PV.
+ # In this case, we simply use that data as if MultiPV was never
+ # specified.
+ #
+ if (exists($uciinfo{'pv1'})) {
+ for my $key qw(pv score_cp score_mate nodes nps depth seldepth tbhits) {
+ if (exists($uciinfo{$key . '1'}) && !exists($uciinfo{$key})) {
+ $uciinfo{$key} = $uciinfo{$key . '1'};
+ }
+ }
+ }
+
+ # single-PV
+ if (defined($uciinfo{'score_mate'})) {
+ my $mate = $uciinfo{'score_mate'};
+ if ($ficsinfo{'toplay'} eq 'B') {
+ $mate = -$mate;
+ }
+ if ($mate > 0) {
+ $text .= sprintf " White mates in %u\n", $mate;
+ } else {
+ $text .= sprintf " Black mates in %u\n", -$mate;
+ }
+ } else {
+ if (exists($uciinfo{'score_cp'})) {
+ my $score = $uciinfo{'score_cp'} * 0.01;
+ if ($ficsinfo{'toplay'} eq 'B') {
+ $score = -$score;
+ }
+ $text .= sprintf " Score: %+5.2f\n", $score;
+ }
+ }
+
+ $text .= " PV: " . join(', ', prettyprint_pv($ficsinfo{'board'}, @{$uciinfo{'pv'}}));
+ $text .= "\n";
+
+ if (exists($uciinfo{'nodes'}) && exists($uciinfo{'nps'}) && exists($uciinfo{'depth'})) {
+ $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{'seldepth'})) {
+ $text .= sprintf " (%u selective)", $uciinfo{'seldepth'};
+ }
+ $text .= "\n\n";