-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPapergame.java
More file actions
85 lines (62 loc) · 1.23 KB
/
Copy pathPapergame.java
File metadata and controls
85 lines (62 loc) · 1.23 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
import java.util.Scanner;
import java.util.Random;
public class Papergame{
public static void main (String[] args){
Scanner input = new Scanner(System.in);
Random rnum = new Random();
System.out.print ("guess between 0,1 and 2);
int random = rnum.nextInt();
int Scissors = 0;
int rock = 1;
int paper = 2;
int user = 0;
int computer = 0;
if(user = 0){
System.out.print("Scissors);
}
if (user = 1){
System.out.print("rock");
}
if (user =2)
System.out.print("paper");
}
if(computer = 0){
System.out.print("Scissors);
}
if (computer = 1){
System.out.print("rock");
}
if (computer =2)
System.out.print("paper");
}
if(computer = 0){
System.out.print("Scissors);
}
if (user == computer){
System.out.print("draw");
}
if (user == 2 && computer == 1){
System.out.print ("You win");
}
if (user == 1 && computer == 0){
System.out.print ("you win");
}
if (user == 0 && computer == 2){
System.out.print ("you win");
}
if (user== 2 && computer == 1){
System.out.print ("you win");
}
while (number == computer){
System.out.println ("enter between 0-2");
number= input.nextInt();
number = number + 1;
}
if (number == computer){
System.out.println ("low number, try again!");
}
if ( user ==computer){
System.out.println ("low number, try again!");
}
}
}