Skip to content

Commit 246bf3e

Browse files
Update BowlingGame.java
1 parent 36e41a8 commit 246bf3e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎exercises/bowling/.meta/src/reference/java/BowlingGame.java‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ int score() {
2525
}
2626

2727
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){
2933
throw new IllegalStateException("Pin count exceeds pins on the lane");
3034
}
3135

@@ -81,4 +85,4 @@ private int spareBonus(int frameIndex) {
8185
private int frameScore(int frameIndex) {
8286
return rolls.get(frameIndex) + rolls.get(frameIndex + 1);
8387
}
84-
}
88+
}

0 commit comments

Comments
 (0)