-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathLadderController.java
More file actions
31 lines (29 loc) · 1.06 KB
/
LadderController.java
File metadata and controls
31 lines (29 loc) · 1.06 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
package controller;
import domain.Ladder;
import domain.LadderGame;
import domain.LadderHeight;
import domain.LadderWidth;
import domain.Players;
import domain.Prizes;
import domain.GameResult;
import view.InputView;
import view.OutputView;
public class LadderController {
public static void main(String[] args) {
InputView inputView = new InputView();
OutputView outputView = new OutputView();
Players players = inputView.askPlayers();
Prizes prizes = inputView.askPrizes();
LadderHeight height = inputView.askHeight();
LadderWidth width = new LadderWidth(players.size());
LadderGame ladderGame = new LadderGame(players, prizes, new Ladder(height, width));
outputView.printLadderGameBoard(ladderGame);
GameResult gameResult = ladderGame.play();
String query = inputView.askResultName();
if (query.equals("all")) {
outputView.printResultAll(gameResult);
return;
}
outputView.printResultSingle(gameResult.getResultByPlayerName(query).getPrize());
}
}