+ return unless (exists($pos_calculating->{'board'}));
+
+ #
+ # 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'}) && !exists($uciinfo{'pv2'})) {
+ 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'};
+ }
+ }
+ }
+
+ my @text_pvs = ();
+ if (exists($uciinfo{'pv1'}) && exists($uciinfo{'pv2'})) {
+ # multi-PV
+ my $mpv = 1;
+ while (exists($uciinfo{'pv' . $mpv})) {
+ $text_pvs[$mpv] = prefix_pv($pos_calculating->{'move_num'}, $pos_calculating->{'toplay'}) .
+ join(' ', prettyprint_pv($pos_calculating->{'board'},
+ $pos_calculating->{'move_num'},
+ $pos_calculating->{'toplay'},
+ @{$uciinfo{'pv' . $mpv}}));
+ ++$mpv;
+ }
+ } else {
+ # single-PV
+ $text_pvs[0] = prefix_pv($pos_calculating->{'move_num'}, $pos_calculating->{'toplay'}) .
+ join(' ', prettyprint_pv($pos_calculating->{'board'},
+ $pos_calculating->{'move_num'},
+ $pos_calculating->{'toplay'},
+ @{$uciinfo{'pv'}}));
+ }