import java.util.Random;
import java.util.Scanner;
public class gsgs {
public static void main(String[] args) {
while (true) {
int i = (int) (1 + Math.random() * 3);
//double j =new Random().nextInt();
System.out.println(" if stone = 1,scissor = 2,cloth = 3");
System.out.print("Please put you choose:");
Scanner a = new Scanner(System.in);
int b = a.nextInt();
if (b == 1) {
System.out.println("you choose to stone");
}
if (b == 2) {
System.out.println("you choose to scissor");
}
if (b == 3) {
System.out.println("you choose to cloth");
}
if (i == 1) {
System.out.println("i choose to stone");
}
if (i == 2) {
System.out.println("i choose to scissor");
}
if (i == 3) {
System.out.println("i choose to cloth");
}
switch ((int) b) {
case 1:
switch (i) {
case 1: {
System.out.println("It's your pleasure to draw with me");
}
break;
case 2: {
System.out.println("Let you win");
}
break;
case 3: {
System.out.println("That's it?You can't either");
}
break;
}
break;
case 2:
switch (i) {
case 1: {
System.out.println("That's it?You can't either ");
}
break;
case 2: {
System.out.println("It's your pleasure to draw with me");
}
break;
case 3: {
System.out.println("Let you win");
}
break;
}
break;
case 3:
switch (i) {
case 1: {
System.out.println("Let you win ");
}
break;
case 2: {
System.out.println("That's it?You can't either");
}
break;
case 3: {
System.out.println("It's your pleasure to draw with me");
}
break;
}
default: System.out.println("Unruly,like you,it's time to fight");
}
System.out.println();
}
}
}
简单的一个石头剪刀布



