Well, the course is now complete and I have a working test
program! I am just mowing the fairways and raking the bunkers
right now. It is a two hole course, a little tougher than
Santa's game, but not as tough as Ton's recent ircnet game at
http://a108.bauhuette.haw-hamburg.de/golf/challenge.html.

There are no 220 yard water carries, so I expect a lot of
beginner entries this time around. Beginners, don't let
Dave Hoover clean you all up again this time around. ;-)
I expect the inventive Jonathan E Paton to be right up
there this time (assuming he still classifies himself
as a beginner;-).

I am also hoping for a wider spread of scores, but this is
golf, after all, and that is very hard to predict.

I have tested both holes and have working solutions with a
similar score using quite a few different approaches.
And I am sure that the wily characters on fwp will concoct
some solutions that I could never dream of. :)
So I am hopeful that the game will prove interesting,
with many and various solutions proffered.

The game starts on Thursday 10:00 am (Sydney time) -- which
is Wednesday afternoon in USA and Wednesday evening in Europe.
The game will run for exactly five days.

To add a little excitement, a current leaderboard will be
posted to fwp at least daily. Beginners are encouraged to
enter and there will be a separate leaderboard for them.

The leaderboard will show total score only. However, exactly
24 hours before the game ends, the lowest available score
for all holes will be published. Also, all current hole
leaders (but not their score) will be continuously updated.

I will also use Ton's BoB (best-of-breed) innovation in
this game. That is, BoB may be a hole leader, if no single
player has found the best known solution on any hole.

If there is a tie, well, it is a tie. Due to time differences
around the world and differing work and family commitments,
there is no fair way to break ties.

It is recommended that you run the test program under Unix
or Windows NT/2000. However, it should also run under
Windows 95/98, albeit with a warning that it cannot detect
what is written to stderr.

The scoring rule is the same as that used in Ton's recent game.
Multiple lines are permitted, with a newline counting as one stroke.
Though the #! line is not counted, the options themselves
(if any) are counted, including the leading space and -.

With a view to identifying any glitches in the test program
before the game starts (rather than after, as happened in Santa's
game) I publish some of the code in the test program now.
If you see something wrong, please let me know before the
game starts!

use strict;

my $have_stderr_redirect = 1;

if ($^O eq 'MSWin32') {
   if (Win32::IsWinNT()) {
      print "You are running Windows NT/2000\n";
   } else {
      print "You are running Windows, but not Windows NT/2000\n";
      $have_stderr_redirect = 0;
   }
} else {
   print "Congratulations! You are not running Windows.\n";
}

# This function is based heavily on Ton's
sub GolfScore {
   my $script = shift;
   local ($_, *FF);
   open(FF, $script) or die "could not open $script: $!";
   my $golf = -1;     # your free last newline
   while (<FF>) {
       s/\n?$/\n/;
       $golf-- if $. == 1 && s/^#!.*?perl//;
       $golf += length;
   }
   close(FF);
   return $golf;
}

sub BuildFile {
   my ($fname, $data) = @_;
   local (*FF);
   open(FF, '>'.$fname) or die "error: open '$fname'";
   print FF $data;
   close(FF);
}

sub CheckOne {
   my ($scr, $label, $data, $exp) = @_;
   my $intmp  = 'in.tmp';
   my $errtmp = 'err.tmp';
   BuildFile($intmp, $data);
   my $cmd = "$^X $scr $intmp";
   $cmd .= " 2>$errtmp" if $have_stderr_redirect;
   print "$label: running: '$cmd'...";
   my $out = `$cmd`; my $rc = $? >> 8;
   print "done.\n";
   if ($have_stderr_redirect) {
      -s $errtmp and
         die "oops, you wrote to stderr (see $errtmp)\n";
   } else {
      warn "warning: cannot check you did not write to" .
           " stderr on this platform.\n";
   }
   if ($out ne $exp) {
      warn "Expected:\n"; print STDERR $exp;
      warn "Got:\n"; print STDERR $out;
      die "\nOops, you failed.\n";
   }
}

See you on the first tee,
/-\ndrew

Reply via email to