uciprint("setoption name NalimovPath value c:\\nalimov");
uciprint("setoption name NalimovUsage value Rarely");
uciprint("setoption name Hash value 1024");
-uciprint("setoption name MultiPV value 3");
+# uciprint("setoption name MultiPV value 3");
# uciprint("setoption name Contempt value 1000");
# uciprint("setoption name Outlook value Ultra Optimistic");
uciprint("ucinewgame");
my $mpv = 1;
while (exists($uciinfo{'pv' . $mpv})) {
$text .= sprintf " PV%2u", $mpv;
+ my $score = short_score(\%uciinfo, \%ficsinfo, $mpv);
+ $text .= " ($score)" if (!defined($score));
- if (defined($uciinfo{'score_mate' . $mpv})) {
- $text .= sprintf " (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;
- }
- $text .= sprintf " (%+5.2f)", $score;
- }
- }
-
if (exists($uciinfo{'nodes' . $mpv}) && exists($uciinfo{'nps' . $mpv}) && exists($uciinfo{'depth' . $mpv})) {
$text .= sprintf " (%5u kn, %3u kn/s, %2u ply)",
$uciinfo{'nodes' . $mpv} / 1000, $uciinfo{'nps' . $mpv} / 1000, $uciinfo{'depth' . $mpv};
}
# 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;
- }
- }
-
+ my $score = long_score(\%uciinfo, \%ficsinfo, '');
+ $text .= " $score\n" if defined($score);
$text .= " PV: " . join(', ', prettyprint_pv($ficsinfo{'board'}, @{$uciinfo{'pv'}}));
$text .= "\n";
print UCIWRITE "$msg\n";
print UCILOG "=> $msg\n";
}
+
+sub short_score {
+ my ($uciinfo, $ficsinfo, $mpv) = @_;
+
+ if (defined($uciinfo{'score_mate' . $mpv})) {
+ return sprintf "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;
+ }
+ return sprintf "%+5.2f", $score;
+ }
+ }
+
+ return undef;
+}
+
+sub long_score {
+ my ($uciinfo, $ficsinfo, $mpv) = @_;
+
+ if (defined($uciinfo{'score_mate' . $mpv})) {
+ my $mate = $uciinfo{'score_mate' . $mpv};
+ if ($ficsinfo{'toplay'} eq 'B') {
+ $mate = -$mate;
+ }
+ if ($mate > 0) {
+ return sprintf "White mates in %u", $mate;
+ } else {
+ return sprintf "Black mates in %u", -$mate;
+ }
+ } else {
+ if (exists($uciinfo{'score_cp' . $mpv})) {
+ my $score = $uciinfo{'score_cp' . $mpv} * 0.01;
+ if ($ficsinfo{'toplay'} eq 'B') {
+ $score = -$score;
+ }
+ return sprintf "Score: %+5.2f", $score;
+ }
+ }
+
+ return undef;
+}