From b827590935f10fd11c664e513f4daf94c52cce2a Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 18 Jul 2021 16:10:20 +0200 Subject: [PATCH] Include the PV move in the low-depth analysis. --- remoteglot.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/remoteglot.pl b/remoteglot.pl index fb663f8..abbbd98 100755 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -544,7 +544,13 @@ sub parse_infos { my $cp = $info->{'score_cp1'} // $info->{'score_cp'}; my $mate = $info->{'score_mate1'} // $info->{'score_mate'}; my $splicepos = $info->{'splicepos1'} // $info->{'splicepos'}; - push @{$info->{'lowdepth'}}, [ $d, $cp, $mate, $splicepos ]; + my $bestmove; + if (defined($info->{'pv1'})) { # Avoid autovivification. + $bestmove = $info->{'pv1'}[0]; + } else { + $bestmove = $info->{'pv'}[0]; + } + push @{$info->{'lowdepth'}}, [ $d, $cp, $mate, $splicepos, $bestmove ]; } } @@ -959,7 +965,9 @@ sub output_json { $json->{'lowdepth'} = {}; if (exists($info->{'lowdepth'})) { for my $ld (@{$info->{'lowdepth'}}) { - $json->{'lowdepth'}{$ld->[0]} = score_digest_inner($ld->[1], $ld->[2], $ld->[3], 0, $pos_calculating); + my $score = score_digest_inner($ld->[1], $ld->[2], $ld->[3], 0, $pos_calculating); + push @$score, prettyprint_pv($pos_calculating, $ld->[4]); + $json->{'lowdepth'}{$ld->[0]} = $score; } } -- 2.39.2