Bowling Score Finale
Strike
A Strike in bowling is when all 10 pins are knocked down in the first bowl of a frame. When there's a strike, the score for the next two bowls is added to the score of the Strike. For example, if this is the pins knocked down in the first 2 frames:
1. 10 2. 5 3
...then the player's score will be
18
for the first frame and 8
for the second frame. The 5
and 3
of the second frame were counted twice.
Note that the score after a Strike can be a Strike or a spare also. You will always add the score of the next 2 bowls to the score of the Strike. For example:
10 10 7 2
The score for this will be:
27 19 9
with a total score of
55
.
Challenge
Print the scores for each turn of a game of bowling and the total score at the end. There can be strikes, spares, and gutter-balls! Note that Strikes will consist of a single 10
in the input, followed by the next turn.
Example
Given the following bowls:
0 3 7 2 10 4 6 10 8 1 7 3 10 10 9 0
...the output should be:
3 9 20 20 19 9 20 29 19 9 157
Challenge
Print the scores for an actual bowling game!
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.
Comments
thales
Jul 19, 1:33 PMTHANK....... finally, it ook me half a day :-( really hard..
a solution:
my code
Daniel Kozmacs
Apr 14, 3:18 PMwow, so there's a simple way :) I've overcomplicated it I guess...
my code
last year I gave up here, so now I know why :D