forked from woowacourse-precourse/java-baseball-6
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGame.java
More file actions
30 lines (25 loc) · 754 Bytes
/
Game.java
File metadata and controls
30 lines (25 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package baseball.game;
import baseball.domain.Answer;
import baseball.domain.BaseballNumber;
import baseball.domain.Computer;
import baseball.domain.EndNumber;
import baseball.view.View;
public class Game {
private Computer computer;
public Game() {
this.computer = new Computer();
}
public void start() {
View.init();
Answer answer;
do {
BaseballNumber baseballNumber = new BaseballNumber(View.input());
answer = computer.calculate(baseballNumber);
View.showAnswer(answer.getString());
} while (answer.isStatusWRONG());
}
public boolean end() {
EndNumber endNumber = new EndNumber(View.showEnd());
return endNumber.isEnd();
}
}