-
Notifications
You must be signed in to change notification settings - Fork 511
Expand file tree
/
Copy pathMain.java
More file actions
38 lines (27 loc) · 781 Bytes
/
Main.java
File metadata and controls
38 lines (27 loc) · 781 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
package practice.snakes.and.ladders;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Game game = new Game();
Scanner scanner = new Scanner(System.in);
int noOfSnakes = scanner.nextInt();
for (int i=1; i<=noOfSnakes; i++) {
int head = scanner.nextInt();
int tail = scanner.nextInt();
game.getBoard().addSnake(head, tail);
}
int noOfLadders = scanner.nextInt();
for (int i=1; i<=noOfLadders; i++) {
int start = scanner.nextInt();
int end = scanner.nextInt();
game.getBoard().addLadder(start, end);
}
int noOfPlayers = scanner.nextInt();
for (int i=1; i<=noOfPlayers; i++) {
String name = scanner.next();
game.addPlayer(name);
}
game.startGame();
scanner.close();
}
}