-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.java
More file actions
97 lines (72 loc) · 2.09 KB
/
game.java
File metadata and controls
97 lines (72 loc) · 2.09 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import java.util.Scanner;
import java.util.Random;
//import javax.lang.model.util.ElementScanner14;
public class game {
public static void main(String args[]) {
// play 1
// 0 - ROCK
// 1 - PAPER
// 2 - SCISSOR
System.out.println("///////// WELECOME TO ROCK PAPER SCISSOR GAME/////////");
System.out.println("");
Scanner sc = new Scanner(System.in);
System.out.println("Your turn: ");
int i = sc.nextInt();
if (i == 0) {
System.out.println("ROCK");
} else if (i == 1) {
System.out.println("PAPER");
}
else if (i == 2) {
System.out.println("SCISSOR ");
} else {
System.out.println("Invalid input");
}
System.out.println("");
System.out.println("");
System.out.println("");
Random rand = new Random();
int minRange = 0, maxRange = 3;
int value = rand.nextInt(maxRange - minRange) + minRange;
System.out.println("Computer's Turn");
System.out.println(value);
if (value == 0) {
System.out.println("ROCK");
} else if (value == 1) {
System.out.println("PAPER");
}
else {
System.out.println("SCISSOR ");
}
System.out.println("");
System.out.println("");
if (i == 0 && value == 0) {
System.out.println("Its Draw ");
}
if (i == 1 && value == 1) {
System.out.println("Its Draw ");
}
if (i == 2 && value == 2) {
System.out.println("Its Draw ");
}
if (i == 1 && value == 0) {
System.out.println("1 point ");
}
if (i == 1 && value == 2) {
System.out.println("Sorry no points ");
}
if (i == 2 && value == 0) {
System.out.println("Sorry no points ");
}
if (i == 2 && value == 1) {
System.out.println("1 point ");
}
if (i == 0 && value == 1) {
System.out.println("Sorry no points ");
}
if (i == 0 && value == 2) {
System.out.println("1 point");
}
// System.out.println("Your Score is: ");
}
}