develooper Front page | perl.golf | Postings from August 2002

Re: And the winner is...Juho Snellman

Thread Previous | Thread Next
From:
perl-golf
Date:
August 7, 2002 22:29
Subject:
Re: And the winner is...Juho Snellman
Message ID:
aisvit$vaj$5@post.home.lunix
In article <3D51FEBC.906@clotho.com>,
	Chris Dolan <chris@clotho.com> writes:
> Eugene van der Pijll wrote:
>> 
>> Unfortunately, his solution doesn't seem to work here.
>> 
>>     $ cat factorial.pl 
>>     #!perl -l
>>     $_*=$`%9e9,//for~4=~/0*$/..pop;print$`%10
>>     $ perl factorial.pl 15
>>     0
>>     $ perl --version
>> 
>>     This is perl, v5.6.1 built for alpha-dec_osf
>> 
>> Can someone explain, please?
>> 
> 
> It's a 32- vs 64- bit thing.  On a 32-bit box, ~4 == 4294967291 (which 
> ends in "1").  On a 64 bit alpha, it is different.
> 
Ok, the rules says the solution has to work on all architectures, so
it should in fact work on 64-bit machines. So his solution is invalid.
However, we as referees should have caught this.

Juho originally had +1 there, and only changed it to ~4 when hunting the
best tie break. So I'm going to apply referees discretion and behave as if 
his top entry is

#!perl -l
$_*=$`%9e9,??for+1=~?0*$?..pop;print$`%10

which is certainly what he would have submitted if the refs had caught ~4.

This gives 

factorial.pl: 44.1212 strokes (ok)
postorder.pl: 51.0831 strokes (ok)
              -------
total:        95.2044 strokes

which is still ahead of Eugene, so i think it's fair to still award Juho
first place. Hopefully everybody will see this as acceptable.

(and BoB falls back to 
#!perl -l
$_*=$`%9e9,??for??=~?0*$?..pop;print$`%10

which scores 44.1175)

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About