Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW


by mitd (Curate)
on Dec 30, 1999 at 08:39 UTC ( #1553=user: print w/replies, xml ) Need Help??

These guys were really nice to me until I told them they weren't at Hooters.

Old fart coder, John MacDonald handed me the the Pink Camel book in 1991, bought my own have had a hump every since.

AI Competition -- 'The Learning Machine Challenge'
Sample Player

#!/usr/bin/perl -w # - a random, game independent, challenge player # # This player can be used as an example for a rather generalized playe +r. # 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 rel +ated # 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; }

Log In?

What's my password?
Create A New User
[stevieb]: I don't know what you mean. I write the code in C/C++ that accesses the ICs per the datasheet, wrap it for Perl, then use them. My code ensures that the functions/methods from Perl do the right thing for the chips/sensors etc
[stevieb]: At least that's what I'm working on right now. I've also been updating my automated test software Test::BrewBuild so it handles this work properly. It's not really easy meshing high level languages with low-level hardware :)
[stevieb]: this link is probably better for an overview of my test software

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2017-06-25 23:12 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (572 votes). Check out past polls.