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

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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:

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (10)
    As of 2015-07-03 17:24 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (54 votes), past polls