Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Comment on

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

I don't know if my logic is wrong but I get a score of 162. I havn't bothered to obfuscate it and print out a score sheet to show the frame by frame results.

my @b = ('5', '/', '6', '3', 'X', 'X', '7', '0', '4', '3', 'X', '4', '/', '8', '1', '3', '/', '6'); print "Frame tog ball score total\n"; print score(@b),"\n\n"; print "Frame tog ball score total\n"; print score(('X')x12); sub score { $i=0;$f=1;$t=1;$score=0; for (@_) { last if $f>10; if(/X/) { $s=10+n($_[$i+1])+n($_[$i+2]); $t=1 } elsif(/\//) { $s=10+n($_[$i+1]); $t=1 } else { $s=$_; $t^=1 # flip the toggle with XOR } $score+=$s; printf "%2d %d %s %2d %3d\n",$f, $t, $_, $s, $scor +e; $t&&$f++; # count the frames $i++; } sub n{$v=pop;$v=~/[X\/]/?10:$v} return $score } __END__ Frame tog ball score total 1 0 5 5 5 1 1 / 16 21 2 0 6 6 27 2 1 3 3 30 3 1 X 27 57 4 1 X 17 74 5 0 7 7 81 5 1 0 0 81 6 0 4 4 85 6 1 3 3 88 7 1 X 24 112 8 0 4 4 116 8 1 / 18 134 9 0 8 8 142 9 1 1 1 143 10 0 3 3 146 10 1 / 16 162 162 Frame tog ball score total 1 1 X 30 30 2 1 X 30 60 3 1 X 30 90 4 1 X 30 120 5 1 X 30 150 6 1 X 30 180 7 1 X 30 210 8 1 X 30 240 9 1 X 30 270 10 1 X 30 300 300

Did I miss something?

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: (Golf) Let's go bowling by tachyon
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
  • Outside of code tags, you may need to use entities for some characters:
            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 exploiting the Monastery: (7)
    As of 2014-12-20 23:21 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (99 votes), past polls