-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathGameController.java
More file actions
47 lines (33 loc) · 947 Bytes
/
GameController.java
File metadata and controls
47 lines (33 loc) · 947 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package controller;
import service.CarService;
import view.GameView;
public class GameController {
private final GameView gameView;
private final CarService carService;
public GameController() {
gameView = new GameView();
carService = new CarService();
}
/*public static GameController getInstance() {
if(gameController == null) {
gameController = new GameController();
}
return gameController;
}*/
public void raceSet(String[] names) {
gameView.printResult();
carService.fill(names);
}
public void race(int count) {
String result = carService.getResult(count);
gameView.printResult(result);
}
public void raceResult() {
String winners = carService.getWinners();
gameView.printWinners(winners);
}
public void close() {
carService.close();
gameView.close();
}
}