user
mitd
<p>
<!-- location:latitude=044.28.35,longitude=-080.12.31 -->
<!-- os:Linux,IRIX -->
<!-- birthday:1952/12/20 -->
<!-- email:perlmonk@mitd.com -->
<!-- tshirts:red=1,blue=1 -->
These <font color="darkgreen"> guys </font> were really nice to me until I told them they weren't at Hooters.
<p>
Old fart coder, <a href="http://www.oreilly.com/catalog/maperl/author.html">John MacDonald</a>
handed me the the Pink Camel book in 1991, bought my own
have had a hump every since.
<p>
<p>
<font size=+1 color="green"><a href="http://www.a-i.com/">AI Competition -- 'The Learning Machine
Challenge'</a>
<br>
Sample Player
</font>
<code>
#!/usr/bin/perl -w
# rnd_player.pl - a random, game independent, challenge player
#
# This player can be used as an example for a rather generalized player.
# The player's logic is quite simple: it response to a request to play,
# it emits a single symbol which is picked in random from the alphabet
# received from the game organizer (judge). The player logic ignores
# the score it receives during the game and contains with generating
# random moved until it is told by the organizer that the game is over
# The program also ignores any symbols it receives, which might be related
# to the moves of other game participants.
#
# usage: invoke though a judge/game program. for debug, simple invoke with
# command line arguments
#
## MitD 08/10/2001 - ported from tcl -> perl
#
use strict;
use Carp;
my $Version = "1.0";
my $Me = "MitD";
#
## we keep our game symbols in a global
#
my $DEBUG = 0;en
my @symbols = ();
my $score = 0;
$|++;
println ('@command info MitDRnd');
println( '# Made in the Dark');
println( '# Artificial Intelligence NV Challenge');
println ('# Player');
println( '# Copyright Peter G. Marshall');
println( '# This is free software; you can redistribute it');
println ('# and/or modify it under the same terms as Perl itself.');
while (<STDIN>) {
chomp;
process_line($_);
}
#
## input channel processor
#
sub chan_input {
my $sym = shift;
}
#
## score channel processor
#
sub chan_score {
my $arg = shift;
$score += $arg;
}
#
## command channel processor
#
sub chan_command {
my ($verb, $args) = split(/ /,$_[0]);
if (defined($args)) {
eval "command_$verb(\"$args\")";
croak "chan_command with args eval failed: $@\n" if ($@);
} else {
eval "command_$verb()";
croak "process no args \@ eval failed: $@\n" if ($@);
}
}
#
## process exit command
#
sub command_exit {
exit;
}
#
## process symbol command
#
sub command_symbol {
my $sym = shift;
push(@symbols, $sym);
debug ( "SYM: " . join(' ',@symbols) . "\n");
}
#
## process new game command
#
sub command_new {
debug ("command new done");
@symbols = ();
}
#
## process play command
#
sub command_play {
my $sym = $symbols[rand scalar(@symbols)];
println ("\@output $sym");
}
sub process_line {
my $line = shift;
debug ("PL: $line");
# ignore empty lines or lines that begin with # (commennts);
return if ( length($line) == 0 or ($line =~ /^#/) );
if ( index($line,'@') == -1) {
eval "chan_input(\"$line\")";
croak "process no \@ eval failed: $@\n" if ($@);
} else {
$line = substr($line,1);
my ($channel, $args) = split(/ /,$line,2);
eval "&chan_$channel(\"$args\")";
croak "process with \@ eval failed: $@\n" if ($@);
}
}
sub println {
print shift() . "\n";
}
sub debug {
print STDERR $_[0],"\n" if $DEBUG;
}
</code>
2017-10-31 17:33:37
3503
358950
images/userincoming/mitd.jpeg
165
Clearview Twp, ON, CDN</td></tr><td>Best Girl: </td><td>Laurie</td></tr><tr><td>Gene Pool Count: </td><td><a href="http://www.mitd.com/images/family.jpg"> 7</a></td></tr><tr><td>URL </td><td><a href="http://www.mitd.com">Made in the Dark</a></td></tr>
-4
40
on
on