-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathBaseBallController.java
More file actions
46 lines (36 loc) · 1.26 KB
/
BaseBallController.java
File metadata and controls
46 lines (36 loc) · 1.26 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
45
46
package controller;
import domain.Computer;
import domain.Score;
import domain.User;
import service.GameServiceImpl;
import service.GameService;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Objects;
public class BaseBallController {
private static Computer computer;
private static User user;
private static Score score;
private static GameService gameService;
public void BaseBallGame() throws IOException {
computer = new Computer();
user = new User();
score = new Score();
gameService = new GameServiceImpl();
String newGame = "1";
while (Objects.equals(newGame, "1")) {
newGame = BaseBallGameStart();
}
}
public static String BaseBallGameStart() throws IOException {
String nextGame = "0";
gameService.startGame(computer, user, score);
while (!Objects.equals(nextGame, "1") && !Objects.equals(nextGame, "2")){
System.out.println("게임을 새로 시작하려면 1, 종료하려면 2를 입력하시오.");
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
nextGame = (reader.readLine());
}
return nextGame;
}
}