From: Matthew Moss Date: 2008-10-24T23:25:45+09:00 Subject: [QUIZ] Bowling Scores (#181) Apologies for not having the Long Division quiz summary done yet. It will come sometime today or tomorrow. Meanwhile, I have the next quiz ready... -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- The three rules of Ruby Quiz 2: 1. Please do not post any solutions or spoiler discussion for this quiz until 48 hours have passed from the time on this message. 2. Support Ruby Quiz 2 by submitting ideas as often as you can! (A permanent, new website is in the works for Ruby Quiz 2. Until then, please visit the temporary website at . 3. Enjoy! Suggestion: A [QUIZ] in the subject of emails about the problem helps everyone on Ruby Talk follow the discussion. Please reply to the original quiz message, if you can. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ## Bowling Scores (#181) Whether it is real or on the Wii, bowling is a fun game. (Okay, for the sake of the quiz, let's assume it's a fun game.) But I've known folks who just don't understand [how to score properly][1]. They can count pins knocked down, and know that getting all ten pins in one roll is good, but they still can't keep score. Your task this week is to tally scores for these people. The input will be the player's name and the number of pins felled from each roll. For example: ruby bowling_scores.rb John 6 2 7 1 10 9 0 8 2 10 10 3 5 7 2 5 5 8 Your should tally the per-frame scores and generate output in table form, such as: John's final score: 140 Frame Roll Roll Score 1 6 2 8 2 7 1 16 3 X 35 4 9 - 44 5 8 / 64 6 X 87 7 X 105 8 3 5 113 9 7 2 122 10 5 / 140 * 8 Note that you should make use of typical bowling symbols: `X` for a strike, `/` for a spare, and `-` for zero. Also, if extra balls were thrown at the end (to supplement a strike or spare in the final frame), list those as frame `*` like the above, but without a score. Extra credit: Generate ascii or graphical output that looks more like the traditional bowling score form, which can be seen on [this page][1]. [1]: http://www.bowling2u.com/trivia/game/scoring.asp