-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCCC'03S1.java
More file actions
56 lines (45 loc) · 1.29 KB
/
Copy pathCCC'03S1.java
File metadata and controls
56 lines (45 loc) · 1.29 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
50
51
52
53
54
55
56
import java.util.*;
public class test {
public static void main(String[]args) {
Scanner sc = new Scanner(System.in);
int player = 1;
int dice = 2;
while (true) {
dice = sc.nextInt();
if (dice >= 2 && dice <= 12) {
if (player + dice <= 100) {
player = player + dice;
//Ladders
if (player == 9) {
player = 34;
} else
if (player == 40) {
player = 64;
} else
if (player == 67) {
player = 86;
} else
//Snakes
if (player == 54) {
player = 19;
} else
if (player == 90) {
player = 48;
} else
if (player == 99) {
player = 77;
}
}
System.out.println("You are now on square " + player);
}
if (dice == 0) {
System.out.print("You Quit!");
break;
}
if (player == 100) {
System.out.print("You Win!");
break;
}
}
}
}