develooper Front page | perl.golf | Postings from January 2007

Re: New Golf

Thread Previous | Thread Next
From:
Andrew Savige
Date:
January 17, 2007 12:35
Subject:
Re: New Golf
Message ID:
823206.65072.qm@web56415.mail.re3.yahoo.com
--- Jasper wrote:
> p.s.
> for($f=12;$f-->0;){
> surely
> for($f=12;--$f;){
> ?

p.p.s. Mr Magoo. I think you meant for($f=12;$f--;)

For cheap thrills, I fixed a few more Magoos, whittling dcutter's 247 to 237:

#!perl -aln
@a=(IV,IX,XL,XC,CD,CM,M,D,C,L,X,V);@b=(I,VI,X,LX,C,DC,DD,CC,LL,XX,VV,II);s/[IXC]\b/$&x4/efor@b;for(@F){for$f(0..12){s/$a[$f]/$b[$f]/g}}($r)=@F;$d++,/p/and$r.=$F[$d]or$r=~s/$F[$d]//for@F;for($f=12;$f--;){$r=~s/$b[$f]/$a[$f]/g}print$r

Daniel, though, in desperation, I did think of doing it this way, a quick
analysis convinced me that not even ô Great Ton could whittle this approach
down to 100. So I didn't pursue it further. It just seemed crazy to me not
to exploit the 4-stroke eval to do the arithmetic.

Generally, I think it's best not to waste too much energy wondering what
the photon ô Great Ton is doing, and just focus on working the problem.
In my case, realizing that you only need to write one converter was the
biggest breakthrough.

Cheers,
/-\


Send instant messages to your online friends http://au.messenger.yahoo.com 

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