-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathLadderController.java
More file actions
49 lines (36 loc) · 1.41 KB
/
LadderController.java
File metadata and controls
49 lines (36 loc) · 1.41 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
47
48
49
package controller;
import domain.Ladder;
import domain.Players;
import domain.ResultTypes;
import view.InputView;
import view.OutputView;
import java.util.List;
public class LadderController {
public Players initializePlayers() {
List<String> playerNames = InputView.splitString(InputView.inputNames());
return new Players(playerNames);
}
public ResultTypes initializeResults(int resultsSize) {
List<String> kindOfResults = InputView.splitString(InputView.inputLadderResults());
return new ResultTypes(kindOfResults, resultsSize);
}
public Ladder initializeLadder(int width) {
int height = InputView.inputHeight();
return new Ladder(width, height);
}
public void playGame(Players players, Ladder ladder) {
ladder.determineLadderResults(players);
}
public void displayAllOutput(Players players, ResultTypes resultTypes, Ladder ladder) {
displayLadder(players, resultTypes, ladder);
displayResults(resultTypes, players);
}
private void displayLadder(Players players, ResultTypes resultTypes, Ladder ladder) {
OutputView.printPlayers(players);
OutputView.drawLadder(ladder);
OutputView.printResultTypes(resultTypes.getResultTypes());
}
private void displayResults(ResultTypes resultTypes, Players players) {
OutputView.printResult(players, resultTypes.getResultTypes());
}
}