forked from JaeHongDev/java-baseball
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.java
More file actions
44 lines (33 loc) · 1.07 KB
/
Application.java
File metadata and controls
44 lines (33 loc) · 1.07 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package baseball;
import baseball.game.GameStatus;
import baseball.game.SingleGame;
import baseball.inout.UserInput;
import baseball.inout.UserOutput;
import java.util.List;
public class Application {
private static UserInput userInput;
private static UserOutput userOutput;
public static void main(String[] args) {
boolean isContinue = true;
startGame();
while (isContinue)
isContinue = playSingleGame();
}
private static void startGame() {
userInput = new UserInput();
userOutput = new UserOutput();
userOutput.initMessage();
}
private static boolean playSingleGame() {
SingleGame singleGame = new SingleGame();
boolean isCorrect = false;
while (!isCorrect) {
List<Integer> playNum = userInput.getNum();
GameStatus gameStatus = singleGame.singleTurn(playNum);
userOutput.statusMessage(gameStatus);
isCorrect = gameStatus.isCorrect();
}
userOutput.endMessage();
return userInput.isContinue();
}
}