On Mercredi 6 Février 2002 10:53, Philippe 'BooK' Bruhat wrote : > I think it's high-time fwp developped the module Game::Golf, or > Game::PerlGolf, to help handling these contests. > > It should have a scoring method (maybe with several scoring rules > (embedded newlines, etc) And even better, I think it should use > Test::Harness to handle testing. > > Then the hole creators would only have to write .t files, which would > be run by the Game::PerlGolf object, which would calculate the score. > And so you could not just fail, but fail on 2 out of 10 (or 20) tests. > > A method to check several entries in a row and automatically provide > the Leader Board would be nice, I think.
This idea was lying around, since I just developped such a script. I mailed it to Andrew and Eugene, since they are our arbiters (last and to-come). So, sorry to both of you guys for duplicate mails. Anyway, here is what I already did (you'll find it as attachment), and a little explanation. Basically, you save incoming mails in a unix-style mailbox. Mails should be formatted like this : -- start of mail -- there can be anything in the body as long as there are entries like this: even.pl #!/usr/bin/perl -p $_="hello world\n" __END__ One can put more than one solution for a given hole. even: # note that only /^name_of_the_hole/ is important #!/usr/bin/perl -p $_="hi world\n" __END__ Sample code should end with __END__ token, which will (of course) not be taken as part of the entry. And one can choose not to give solution for every hole. If the word beginner appears in the mail (like this), entry will be classified as a beginner entry. Sincerely, Perl Golfer -- end of mail -- To know what are the hole names, there is a directory "tests/". The arbiter (eh, you for example) should place files in this directory like this (taking even golf as example): $ ls tests/ even.1.pl gs.1.pl You can also put more than one test file for a given hole, like this: $ ls tests/ even.1.pl gs.1.pl gs.2.pl Test files are perl scripts that will receive the path to the file to be tested as their first arg. Test scripts should output something (anything) if the tested file does not pass the test. An ok-for-this-test-file should _not_ output anything on either STDOUT/STDERR. The script scorer.pl accepts those args : ../scorer -e <file> will parse <file> and extract solutions in "extracted/". ../scorer -c will check every file in "extracted/" and put them either in "accepted/" or in "rejected/". ../scorer -p will print leaderboard, as well as hole leaders. One can put those in one pass, like this: ../scorer -c -e <file> -p I put a sample mbox file to play with. Those examples are taken from the Even golf tournament; I adapted the test scripts, so you can see them in tests/ directory. More to come (TODO): - a GUI may be cool, with some graphs with curves for global / by-hole leader. - maybe allow user to provide a nick to display instead of email. - allow user to choose directories where to put files. - ... This is not exactly a module, nor does it use Test::Harness, but maybe we can reuse some part of it. Or let's get rid of it and restart from scratch. Anyway, if somebody would like to put this idea a little further, then I'm in! Jerome -- [EMAIL PROTECTED]
scorer.tgz
Description: GNU Zip compressed data