Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Clear questions and runnable code
get the best and fastest answer

Comment on


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. 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:

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// }
which gets me to 98!

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:

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// }
which puts me back up at 103.

        - tye (but my friends call me "Tye")

In reply to (tye)Re: (Golf) Let's go bowling by tye
in thread (Golf) Let's go bowling by virtualsue

and:  <code> code here </code>

  • Please read these before you post! —
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    As of 2014-03-17 20:48 GMT
    Find Nodes?
      Voting Booth?

      Have you used a cryptocurrency?

      Results (358 votes), past polls