Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (8)
As of 2024-04-19 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found