-
Notifications
You must be signed in to change notification settings - Fork 252
Expand file tree
/
Copy pathGame.java
More file actions
44 lines (33 loc) · 1.21 KB
/
Game.java
File metadata and controls
44 lines (33 loc) · 1.21 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
package ladder1;
import java.util.ArrayList;
import java.util.List;
public class Game {
public static void main(String[] args) {
InputView inputView = new InputView();
ResultView resultView = new ResultView();
List<String> participantNames;
int ladderHeight;
try {
participantNames = inputView.getParticipantNames();
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
return; // 오류 발생 시 프로그램을 종료
}
try {
ladderHeight = inputView.getLadderHeight();
}catch (Exception e) {
System.out.println(e.getMessage());
return; // 오류 발생 시 프로그램을 종료
}
resultView.printParticipants(participantNames);
List<Ladder> completeLadder = new ArrayList<>();
for (int i = 0; i < ladderHeight; i++) {
Ladder l = new Ladder(participantNames.size(), ladderHeight);
l.makeLadder();
completeLadder.add(l);
}
for (Ladder l : completeLadder) {
resultView.printLadder(l.getLadder());
}
}
}