]> git.sesse.net Git - remoteglot/commitdiff
Add some primitive remote control.
authorSteinar H. Gunderson <sesse@debian.org>
Sat, 7 Jul 2007 18:43:54 +0000 (20:43 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Sat, 7 Jul 2007 18:43:54 +0000 (20:43 +0200)
remoteglot.pl

index 6b423f691573fafa8c85761e5e4abc41cb6e0754..8c871084ead93aca57e599d80e1a98aaaf927a8b 100755 (executable)
@@ -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;
        }