Skip to content

Commit d5ba632

Browse files
Changed some parameters and statements
1 parent 36e41a8 commit d5ba632

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ int score() {
2323
if (rolls.size() <= frameIndex + 2) {
2424
throw new IllegalStateException("Score cannot be taken until the end of the game");
2525
}
26-
26+
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) || spareBonus(frameIndex) > 10) {
2929
throw new IllegalStateException("Pin count exceeds pins on the lane");
30-
}
31-
30+
}
31+
3232
score += 10 + strikeBonus;
3333
frameIndex += i == NUMBER_OF_FRAMES ? 3 : 1;
3434
} else if (isSpare(frameIndex)) {
@@ -81,4 +81,4 @@ private int spareBonus(int frameIndex) {
8181
private int frameScore(int frameIndex) {
8282
return rolls.get(frameIndex) + rolls.get(frameIndex + 1);
8383
}
84-
}
84+
}

‎exercises/bowling/src/test/java/BowlingTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public void twoRollsInAFrameCanNotScoreMoreThan10Points() {
190190
@Ignore("Remove to run test")
191191
@Test
192192
public void bonusRollAfterAStrikeInTheLastFrameCanNotScoreMoreThan10Points() {
193-
int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11};
193+
int[] rolls = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 0};
194194

195195
playGame(rolls);
196196

0 commit comments

Comments
 (0)