-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.java
34 lines (25 loc) · 809 Bytes
/
main.java
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
import java.util.Scanner;
public class PlayLadderAndSnake {
public static void main(String[] args) {
/**
* ask user to enter the number of players using while loop to make sure the
* user enter a number within the range 2-4
*/
System.out.println("Entere the number of player");
Scanner input = new Scanner(System.in);
int numberOfPlayrs = input.nextInt();
while (numberOfPlayrs != 2 && numberOfPlayrs != 3 && numberOfPlayrs != 4) {
System.out.println("The number of players must be between 2 and 4 inclusively, please enter again");
numberOfPlayrs = input.nextInt();
}
/**
* create a game and call the methods
*/
LadderAndSnake s = new LadderAndSnake(numberOfPlayrs);
s.map();
s.decidOrder(numberOfPlayrs);
s.checkOder();
s.play();
input.close();
}
}