in reply to Re: (Golf) Let's go bowling
in thread (Golf) Let's go bowling
I think you misunderstood what I was thinking. This routine requires a single string instead of a list of single-character scalars and weighs in at just 103 strokes!
sub bowl { $_=pop; s#(\d)([\d/](?=(.)))|X(?=(..))|.#$3?"X$3":$4?"X$4":$1.$2#ge; s#\d/#/#g; map{(y./X.aa.)x hex}split// }
Or, you can handle getting the pinfall data any way you want. I don't care, so long as the code calculates scores correctly....so I don't consider this cheating. (: You can replace theh first statement with $_=join'',@_; if you disagree and I'm still only at 109. This is a fairly long thread so I'm almost certain I missed something, but I didn't see any scores that low.
Update: I can golf that down a bit if you don't mind me using more undef strings which would generate warnings if such were enabled (the original only does that for the bonus balls). Also, I golfed the tr down by one stroke:
which gets me to 98!sub bowl { $_=pop; s#(\d)(\d|/(?=(.)))|X(?=(..))|.#$3.$4?"X$3$4":$1.$2#ge; s#\d/#/#g; map{(y./X.a.)x hex}split// }
Oh, and I did cheat in that you have to call this in a scalar context or you get what looks like a binary number. I'll take a 2-stroke penalty ("0+") for that if required.
Update: Darn, I just noticed that a late bug fix (for /X\d\d/ in the tenth frame) got left out but that fix breaks things worse. An alternate bug fix hurts a little more:
which puts me back up at 103. - tye (but my friends call me "Tye")sub bowl { $_=pop; s#(\d)(\d(?=.)|/(?=(.)))|X(?=(..))|.#$3.$4?"X$3$4":$1.$2#ge; s#\d/#/#g; map{(y./X.a.)x hex}split// }
|
---|
Replies are listed 'Best First'. | |
---|---|
(tye)Re2: (Golf) Let's go bowling (98!)
by tye (Sage) on Aug 13, 2001 at 19:27 UTC | |
by petral (Curate) on Aug 14, 2001 at 01:59 UTC | |
by tye (Sage) on Aug 14, 2001 at 03:29 UTC | |
by petral (Curate) on Aug 14, 2001 at 20:41 UTC | |
by tye (Sage) on Aug 15, 2001 at 03:58 UTC | |
|