+
+ return unless (exists($ficsinfo{'board'}));
+
+ if (exists($uciinfo{'pv1'}) && exists($uciinfo{'pv2'})) {
+ # multi-PV
+ my $mpv = 1;
+ while (exists($uciinfo{'pv' . $mpv})) {
+ printf " PV%2u", $mpv;
+
+ if (defined($uciinfo{'score_mate' . $mpv})) {
+ printf " (M%3d)", $uciinfo{'score_mate' . $mpv};
+ } else {
+ if (exists($uciinfo{'score_cp' . $mpv})) {
+ my $score = $uciinfo{'score_cp' . $mpv} * 0.01;
+ if ($ficsinfo{'toplay'} eq 'B') {
+ $score = -$score;
+ }
+ printf " (%+5.2f)", $score;
+ }
+ }
+
+ if (exists($uciinfo{'nodes' . $mpv}) && exists($uciinfo{'nps' . $mpv}) && exists($uciinfo{'depth' . $mpv})) {
+ printf " (%5u kn, %3u kn/s, %2u ply)",
+ $uciinfo{'nodes' . $mpv} / 1000, $uciinfo{'nps' . $mpv} / 1000, $uciinfo{'depth' . $mpv};
+ }
+
+ print ":\n";
+ print " ", join(', ', prettyprint_pv($ficsinfo{'board'}, @{$uciinfo{'pv' . $mpv}})), "\n";
+ print "\n";
+ ++$mpv;
+ }
+ } 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) {
+ 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;
+ if ($ficsinfo{'toplay'} eq 'B') {
+ $score = -$score;
+ }
+ printf " Score: %+5.2f\n", $score;
+ }
+ }
+
+ 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'};
+ }
+ if (exists($uciinfo{'seldepth'})) {
+ printf " (%u selective)", $uciinfo{'seldepth'};
+ }
+ print "\n\n";