X-Git-Url: https://git.sesse.net/?p=remoteglot;a=blobdiff_plain;f=remoteglot.pl;h=f6a94028ef2d4ac1d65705f20ed08261bd86b46d;hp=e3169a5f50b6261835a405d773df4f9b0b1722e5;hb=a60af160df125d0e0e5ef03e52f473f1df7af030;hpb=4b5aa1a223cf6e4fa02128c240f018e3f9c49eb4 diff --git a/remoteglot.pl b/remoteglot.pl index e3169a5..f6a9402 100755 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -25,6 +25,12 @@ my $target = "Sesse"; # my $engine = "/usr/games/toga2"; my $engine = "wine Rybkav2.3.2a.mp.w32.exe"; +open(FICSLOG, ">ficslog.txt") + or die "ficslog.txt: $!"; +print FICSLOG "Log starting.\n"; +select(FICSLOG); +$| = 1; + open(UCILOG, ">ucilog.txt") or die "ucilog.txt: $!"; print UCILOG "Log starting.\n"; @@ -46,7 +52,8 @@ while () { uciprint("setoption name UCI_AnalyseMode value true"); uciprint("setoption name NalimovPath value c:\\nalimov"); -uciprint("setoption name NalimovUsage value Normally"); +uciprint("setoption name NalimovUsage value Rarely"); +uciprint("setoption name Hash value 1024"); # uciprint("setoption name MultiPV value 3"); # uciprint("setoption name Contempt value 1000"); # uciprint("setoption name Outlook value Ultra Optimistic"); @@ -56,7 +63,7 @@ print "Chess engine ready.\n"; # now talk to FICS my $t = Net::Telnet->new(Timeout => 10, Prompt => '/fics% /'); -#$t->input_log(\*STDOUT); +$t->input_log(\*FICSLOG); $t->open($server); $t->print("guest"); $t->waitfor('/Press return to enter the server/'); @@ -297,7 +304,7 @@ sub prettyprint_pv { # rook substr($nb[0], 7, 1, '-'); - substr($nb[0], 5, 1, 'R'); + substr($nb[0], 5, 1, 'r'); return ('0-0', prettyprint_pv(\@nb, @pvs)); } @@ -312,7 +319,7 @@ sub prettyprint_pv { # rook substr($nb[0], 0, 1, '-'); - substr($nb[0], 3, 1, 'R'); + substr($nb[0], 3, 1, 'r'); return ('0-0-0', prettyprint_pv(\@nb, @pvs)); } @@ -434,7 +441,15 @@ sub output_screen { } else { # single-PV if (defined($uciinfo{'score_mate'})) { - printf " Mate in %d\n", $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;