Skip to content

Commit 22cc974

Browse files
committed
올스트라이크 판정 버그 수정
1 parent 4adc604 commit 22cc974

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

number-baseball/src/main/java/io/github/gunkim/baseball/domain/BaseBallGame.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.github.gunkim.baseball.domain;
22

33
public class BaseBallGame {
4-
54
private final Input userInput;
65
private final Input computerInput;
76
private final Output output;
@@ -30,7 +29,7 @@ public void start() {
3029
}
3130

3231
private boolean checkGameEnd(final Result result) {
33-
if (result.isAllStrike()) {
32+
if (result.isAllStrike(totalBallCount)) {
3433
output.gameEndedMessage(totalBallCount);
3534
return true;
3635
}

number-baseball/src/main/java/io/github/gunkim/baseball/domain/Result.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ public record Result(
44
int strike,
55
int ball
66
) {
7-
public boolean isAllStrike() {
8-
return ball == 0 && strike > 0;
7+
public boolean isAllStrike(final int totalBallCount) {
8+
return strike == totalBallCount;
99
}
1010

1111
public boolean isNothing() {

0 commit comments

Comments
 (0)