You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ae9feeb
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: exercises/bowling/README.md
+20-6Lines changed: 20 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,29 @@
2
2
3
3
Score a bowling game.
4
4
5
-
Bowling is game where players roll a heavy ball to knock down pins
5
+
Bowling is a game where players roll a heavy ball to knock down pins
6
6
arranged in a triangle. Write code to keep track of the score
7
7
of a game of bowling.
8
8
9
9
## Scoring Bowling
10
10
11
-
The game consists of 10 frames. A frame is composed of one or two ball throws with 10 pins standing at frame initialization. There are three cases for the tabulation of a frame.
11
+
The game consists of 10 frames. A frame is composed of one or two ball
12
+
throws with 10 pins standing at frame initialization. There are three
13
+
cases for the tabulation of a frame.
12
14
13
-
* An open frame is where a score of less than 10 is recorded for the frame. In this case the score for the frame is the number of pins knocked down.
15
+
* An open frame is where a score of less than 10 is recorded for the
16
+
frame. In this case the score for the frame is the number of pins
17
+
knocked down.
14
18
15
-
* A spare is where all ten pins are knocked down after the second throw. The total value of a spare is 10 plus the number of pins knocked down in their next throw.
19
+
* A spare is where all ten pins are knocked down by the second
20
+
throw. The total value of a spare is 10 plus the number of pins
21
+
knocked down in their next throw.
16
22
17
-
* A strike is where all ten pins are knocked down after the first throw. The total value of a strike is 10 plus the number of pins knocked down in their next two throws. If a strike is immediately followed by a second strike, then we can not total the value of first strike until they throw the ball one more time.
23
+
* A strike is where all ten pins are knocked down by the first
24
+
throw. The total value of a strike is 10 plus the number of pins
25
+
knocked down in the next two throws. If a strike is immediately
26
+
followed by a second strike, then the value of the first strike
27
+
cannot be determined until the ball is thrown one more time.
18
28
19
29
Here is a three frame example:
20
30
@@ -30,7 +40,11 @@ Frame 3 is (9 + 0) = 9
30
40
31
41
This means the current running total is 48.
32
42
33
-
The tenth frame in the game is a special case. If someone throws a strike or a spare then they get a fill ball. Fill balls exist to calculate the total of the 10th frame. Scoring a strike or spare on the fill ball does not give the player more fill balls. The total value of the 10th frame is the total number of pins knocked down.
43
+
The tenth frame in the game is a special case. If someone throws a
44
+
strike or a spare then they get a fill ball. Fill balls exist to
45
+
calculate the total of the 10th frame. Scoring a strike or spare on
46
+
the fill ball does not give the player more fill balls. The total
47
+
value of the 10th frame is the total number of pins knocked down.
34
48
35
49
For a tenth frame of X1/ (strike and a spare), the total value is 20.
0 commit comments