-
Notifications
You must be signed in to change notification settings - Fork 506
Expand file tree
/
Copy pathMain.java
More file actions
44 lines (37 loc) · 1.06 KB
/
Main.java
File metadata and controls
44 lines (37 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
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int s = scanner.nextInt();
List<int[]> snakes = new ArrayList<>();
for (int i = 0; i < s; i++) {
int head = scanner.nextInt();
int tail = scanner.nextInt();
snakes.add(new int[] { head, tail });
}
int l = scanner.nextInt();
List<int[]> ladders = new ArrayList<>();
for (int i = 0; i < l; i++) {
int start = scanner.nextInt();
int end = scanner.nextInt();
ladders.add(new int[] { start, end });
}
int p = scanner.nextInt();
List<Player> players = new ArrayList<>();
for (int i = 0; i < p; i++) {
String name = scanner.next();
players.add(new Player(name));
}
scanner.close();
Board board = new Board(100);
Game game = new Game(board);
game.setSnakes(snakes);
game.setLadders(ladders);
for (Player player : players) {
game.addPlayer(player);
}
game.play();
}
}