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

Re: more minigolf

Thread Previous | Thread Next
From:
Chris Dolan
Date:
July 11, 2002 08:08
Subject:
Re: more minigolf
Message ID:
3D2D9DF4.1060704@clotho.com
Eugene van der Pijll wrote:
> 
> 36, for both. However, my solution doesn't comply to one of the standard
> rules of the TPR courses, and I can't test it. But it should work.
> 
> (This is one of the challenges I consired and discarded for the May
> contest, so I've thought about this already then.)
> 

Inspired by this intriguing email by Eugene, I tried a rand() approach.
 This is as far as I got (a one-based solution, at 108 after obvious
compression is applied):

#!perl
use Math::Random;
$z=pop;
map$_>0&&$_<$z&&$_[$_]++,random_normal 4e4,$z/2;
$_=int 0.5+$_/$_[-1]for@_;
print"@_\n"

It *usually* succeeds up to N=5, but fails after that.

Chris


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