I'm new to the whole golfing game, and I'm trying to get my swing down...
Regarding this last puzzle, I've created a solution (albeit extremely long
in comparison to some of those I've seen in older puzzles), and in trying to
get a feel for the shortcuts that all of you use, I'm wondering if perha
ng problem using switches.
It seems as though -n and -p would be extremely useful here, but I always
get errors when I try via either a script or from the command line. Has
anyone dealt with this?
-Riley
y thoughts?
In addition, can anyone tell me why the code below was
rejected?
map{$i=0;y/ #
/01/;map{$x[$i++].=$_}/(...)./g}<>;print
map{index('\xf6\xde$\x92\xe7\xce\xe7\x9e\xb7\x92\xf3\x9e\xf3\xde\xe4\x92\xf7
\xde\xf7\x9e',pack B16,$_)/[EMAIL PROTECTED]
-Riley (o0lit3)
"Juho Sn
ion) makes the while
loop run more than 4 times. (I have a feeling,
however, that the loop is running many more than
9 times as in ton's alternate solution above, and
on first glance, I would have declared that we had
created an infinite loop.)
Many thanks,
Riley o0lit3
nd the rule, I'll know not to make the mistake again, but
if we want to talk about modifiying the rules as to avoid any confusion, I
think
rule #3 "..should always be correct" should be changed to ..."MUST always
be 100% correct." That way a newbie who hasn't gone through the most
recent golf will be more wary when using rand...
Thanks for the help.
-Riley
(o0lit3)
Hello All!
Is it normal to get to a point where you don't really
know what your code is actually doing?
I'm really suspicious of my current solution. Any
chances on an enhanced testsuite?
-Riley
(o0lit3)
sor, there will be a corresponding summation.
The reason even divisors don't allow this should be obvious: we
need an odd number of components in order to be able to add
the same amounts on the right that we subtracted from the left...
-Riley
(o0lit3)
P.S. - Note the following example as well
just a coincidence, the
fact that our y-intercept is also a power of 3, and not
just any power of the three, but the next in sequence?
-Riley
(o0lit3)
P.s. -My solution:
-plaF [EMAIL PROTECTED]/2-/ . (.)/*28+9*$'+3*$1+$&]Why is it that I always forget
that I don't need the -F switch
w
ode}/'s!{code}!{code}!'.'e'x5/ee
or:
eval 's/{code}/{code}/'.'e'x5
Thanks
-Riley
(o0lit3)
?
Thanks
-Riley
"Ton Hospel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Note for golf preparers: A new version of gentest.pl is out.
> Get it from http://www.xs4all.nl/~thospel/golf/gentest.pl
>
> Mainly changes to make life easy for test developers:
&g
After reading the rules again, I answered my own question:
"...Also, any digit in the input will be part of a backreference..."
Thanks,
Riley
"Ton Hospel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Note for golf preparers: A new version of gen
Hello All!
While we're waiting for the new golf, I wanted to share with everyone
a new script that I've written, and open it up to discussion. Kudos to
those who can figure out what it does without running it...
-Riley
(o0lit3)
#!/usr/bin/perl -l
@J=(1);[EMAIL PROTECTED],1;[EMAIL PRO
Hello Ton!
-lp /.+()(?{$n|=(${"@-"}.=$&)x=-index$&,0})^/}{$_=length$n
I get 56 instead of 16 on the first test in the testsuite for the above
solution.
Also, can anyone tell me why the following doesn't work?
-lp0 /
/,$_&=$'./1+(?{$;|=$&x$^C})^/while++$^C;$_=length$
Cheers!-Riley (o0lit3)
ing formats in such a way that
the solution runs as expected in Dos format, but not in Unix format? I
thought the main difference in the two formats was in how carriage returns
are saved, but maybe there's something more...
-Riley
(o0lit3)
?{...}) block in the pattern match
by
somehow setting $_=$&? I tried doing this, but weird things started
happening.
-Riley
(o0lit3)
Hello Ton!
Is it safe to assume that the target (exit) horizontal car will always be
only two units in length?
-Riley
"Ton Hospel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> A new golf "Rush hour" is at http://terje2.perlgol
game
trees again. I had a hell of a time avoiding those damn cycles.
-Riley
(o0lit3)
"Jasper" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Golfers,
>
> Although I enjoyed it very much, I really don't think it deserver the
> title minigolf.
>
hich (at least in my version) turns out to be of similar length:
-l print 0|(1x pop)!~/^(11+)\1+$/
I'm writing the above from memory, so I'm not sure if it's exact. Does
anyone know the origin of this algorithm? Was it the result of some ancient
golf?
Many thanks,
Riley
(o0lit3
until one player has a
margin of two games per set?
-Riley
(o0lit3)
"Mtv Europe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello All!
>
> New golf "Tennis Scoresheet" has started, thanks to TopMach:
> http://terje2.perlgolf.org/~pgas/score.pl?func=rules&hole=67
>
> --
> Mtv Europe
27;d be extremely
interested to see it.
Now the pertinent question:
Does a solution with this probability *really* violate rule #3?
I would wager that it's more likely that our "perfect" computer
would get struck by lightening than our output not being correct.
And what if we were
1001 1101
0010 0110 1010 1110
0011 0111 1011
So I think the problem may be that ((n!-1)/n!)^4 is
the probabilty that I will not choose any one
particular item. But I need the probability that
I won't choose ANY particular item!
make f(n) = 1 - (n * ((n!-1)/n!)^x)
so in our case f(n
ses, making the code only
practical for n <= 4.)
#!/usr/bin/perl -l
sub f {$_[0]<2?$_[0]:$_[0]*f($_[0]-1)}
sub g {
$_[2]=$_[0]**$_[1];
$_[2]-=(f($_[0])/(f($_[0]-$_)*f($_)))*g($_,$_[1])for 1..$_[0]-1;
$_[2]
}
print g(f($ARGV[0]),$ARGV[1])/f($ARGV[0])**$ARGV[1]
## Riley
## (o0lit3)
endent. Would we see the
above differences on every machine?
-Riley
(o0lit3)
ermutations of n items with x random
selections.
(Please note that running time increasing
dramatically as n increases, making the code only
practical for n <= 4.)
#!/usr/bin/perl -l
sub f {$_[0]<2?$_[0]:$_[0]*f($_[0]-1)}
sub g {
$_[2]=$_[0]**$_[1];
$_[2]-=(f($_[0])/(f($_[0]-$_)*f($_)))*g($_,$_[1])for 1..$_[0]-1;
$_[2]
}
print g(f($ARGV[0]),$ARGV[1])/f($ARGV[0])**$ARGV[1]
## Riley
## (o0lit3)
ith x random
selections.
(Please note that running time increasing
dramatically as n increases, making the code only
practical for n <= 4.)
#!/usr/bin/perl -l
sub f {$_[0]<2?$_[0]:$_[0]*f($_[0]-1)}
sub g {
$_[2]=$_[0]**$_[1];
$_[2]-=(f($_[0])/(f($_[0]-$_)*f($_)))*g($_,$_[1])for 1..$_[0]-1;
$_[2]
}
print g(f($ARGV[0]),$ARGV[1])/f($ARGV[0])**$ARGV[1]
## Riley
## (o0lit3)
25 matches
Mail list logo