|
|
@@ -25,7 +25,11 @@ class BowlingGame {
|
|
25
|
25
|
}
|
|
26
|
26
|
|
|
27
|
27
|
int strikeBonus = strikeBonus(frameIndex);
|
|
28
|
|
- if (strikeBonus > MAXIMUM_FRAME_SCORE && !isStrike(frameIndex + 1) && spareBonus(frameIndex) > 10) {
|
|
|
28
|
+ if (strikeBonus > MAXIMUM_FRAME_SCORE && !isStrike(frameIndex + 1)) {
|
|
|
29
|
+ throw new IllegalStateException("Pin count exceeds pins on the lane");
|
|
|
30
|
+ }
|
|
|
31
|
+
|
|
|
32
|
+ if(spareBonus(frameIndex) > 10){
|
|
29
|
33
|
throw new IllegalStateException("Pin count exceeds pins on the lane");
|
|
30
|
34
|
}
|
|
31
|
35
|
|
|
|
@@ -81,4 +85,4 @@ class BowlingGame {
|
|
81
|
85
|
private int frameScore(int frameIndex) {
|
|
82
|
86
|
return rolls.get(frameIndex) + rolls.get(frameIndex + 1);
|
|
83
|
87
|
}
|
|
84
|
|
-}
|
|
|
88
|
+}
|