From ec2386e69c22c62ee666fb9a8aab7481335b5b54 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 7 Jul 2007 20:43:54 +0200 Subject: [PATCH] Add some primitive remote control. --- remoteglot.pl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/remoteglot.pl b/remoteglot.pl index 6b423f6..8c87108 100755 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -24,6 +24,11 @@ my $engine = "wine Rybkav2.3.2a.mp.w32.exe"; my $telltarget = undef; # undef to be silent my @tell_intervals = (5, 20, 60, 120, 240, 480, 960); # after each move my $uci_assume_full_compliance = 1; # dangerous :-) +my @masters = ( + 'Sesse', + 'Sessse', + 'Sesssse' +); # Program starts here $SIG{ALRM} = sub { output_screen(); }; @@ -148,6 +153,21 @@ while (1) { # $t->cmd("date"); } + if ($line =~ /^([A-Za-z]+)(?:\([A-Z]+\))* tells you: (.*)$/) { + my ($who, $msg) = ($1, $2); + + next if (grep { $_ eq $who } (@masters) == 0); + + if ($msg =~ /^fics (.*?)$/) { + $t->cmd("tell $who Executing '$1' on FICS."); + $t->cmd($1); + } elsif ($msg =~ /^uci (.*?)$/) { + $t->cmd("tell $who Sending '$1' to the engine."); + print UCIWRITE "$1\n"; + } else { + $t->cmd("tell $who Couldn't understand '$msg', sorry."); + } + } #print "FICS: [$line]\n"; $sleep = 0; } -- 2.39.2