-
Notifications
You must be signed in to change notification settings - Fork 906
Expand file tree
/
Copy pathNumberBaseballGameService.java
More file actions
31 lines (23 loc) · 1022 Bytes
/
NumberBaseballGameService.java
File metadata and controls
31 lines (23 loc) · 1022 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
31
import gameResult.GameResult;
import gameResult.GameResultVerifyService;
import answer.ComputerAnswerService;
import answer.ComputerAnswerServiceImpl;
import input.InputViewService;
import static gameResult.GameResult.createDefaultGameResult;
public class NumberBaseballGameService {
void playOneGame() {
// 3자리 서로다른 수 생성
ComputerAnswerService computerAnswerService = new ComputerAnswerServiceImpl();
int[] computeAnswer = computerAnswerService.makeAnswer();
InputViewService inputViewService = new InputViewService();
GameResultVerifyService inputAnswerVerifyService = new GameResultVerifyService();
GameResult gameResult = createDefaultGameResult();
while(!gameResult.isWin()) {
// 입력받기
int[] input = inputViewService.processInput();
// 결과판단
gameResult = inputAnswerVerifyService.verify(computeAnswer, input);
gameResult.printGameResult();
}
}
}