use strict;
use warnings;
-$SIG{ALRM} = sub { output_screen(); };
-
-$| = 1;
-
+# Configuration
my $server = "freechess.org";
my $target = "Sesse";
# my $engine = "/usr/games/toga2";
my $engine = "wine Rybkav2.3.2a.mp.w32.exe";
+# Program starts here
+$SIG{ALRM} = sub { output_screen(); };
+
+$| = 1;
+
open(FICSLOG, ">ficslog.txt")
or die "ficslog.txt: $!";
print FICSLOG "Log starting.\n";
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");
uciprint("stop");
uciprint("position fen $fen");
uciprint("go infinite");
+
+ #
+ # Output a command every move to note that we're
+ # still paying attention -- this is a good tradeoff,
+ # since if no move has happened in the last half
+ # hour, the analysis/relay has most likely stopped
+ # and we should stop hogging server resources.
+ #
+ $t->cmd("date");
}
#print "FICS: [$line]\n";
$sleep = 0;
return unless (exists($ficsinfo{'board'}));
- if (exists($uciinfo{'pv1'})) {
+ if (exists($uciinfo{'pv1'}) && exists($uciinfo{'pv2'})) {
# multi-PV
my $mpv = 1;
while (exists($uciinfo{'pv' . $mpv})) {
++$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'};