In article <[EMAIL PROTECTED]>,
        Shlomi Fish <[EMAIL PROTECTED]> writes:
> In any case, there's an exploitable "feature" in the count sub-routine in the
> testsuite:
>
> <<<
> sub count {
>     my ($hole, $tie) = @_;
>     local $_ = slurp($props{$hole}{work}, $binary);
>     if (/^\#!/) {
>       s/^\#![\t ]?\S+// && s/\n//;
>     }
>     s/\s*\z//;              <--------
>     my $md5   = md5_hex($_);
>     my $score = length;
>     my $normal        = $score ? y/ -~\t\n// / $score : 1;
>     if (defined($tie)) {
>       defined(my $code = $tie_map{lc($tie)}) ||
>           die "Unknown tie function $tie\n";
>       $score += $code->($_, $score)/$nr_ties if $score;
>       $ties++;
>     }
>     return ($score, $md5, $normal*100);
> }
>
>>>>
>
> What happens is that trailing whitespace is removed. But one can use it to
> encode the entire program, no matter how long it is, and get a 25 characters
> solution.

In fact the space removal code is there intentionally because in
previous golfs people actually had programs counted with extra chars
because they forgot to remove trailing newlines/spaces (which can be hard
to spot in some editors). This was considered unfair to these players and
on popular request I added the space stripping.

Nobody said that what the test program says is your official score, just
as passing the tests doen't make your program officially correct.
The generic rules at http://www.xs4all.nl/~thospel/golf/rules.html is
where scoring is defined for most minigolfs, and they define the score
as total number of bytes, and then it's clear all these end spaces
count.

So if someone submits a program that uses end spaces to encode the
solution, simply smile at him and put him at a score that is his total
byte length.

I could make a patch for the gentester, but I think it would cause
more problems than it solves.

Reply via email to