From: Steinar H. Gunderson Date: Sat, 7 Jul 2007 18:43:54 +0000 (+0200) Subject: Add some primitive remote control. X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=ec2386e69c22c62ee666fb9a8aab7481335b5b54 Add some primitive remote control. --- 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; }