package done;
import java.util.Random;
import java.util.Scanner;
public class User6 {
public static void main(String[] args) {
while(true) {
String[] yx= {"石头","剪刀","布"};
Random random=new Random();//随机出石头,剪刀,布
int dome=random.nextInt(yx.length);
System.out.print(yx[dome]);
System.out.print("请出拳:");
Scanner input=new Scanner(System.in);
String num=input.next();
if(yx.equals("石头")||yx.equals("剪刀")&&yx.equals("剪刀")||yx.equals("布")&&yx.equals("布")||yx.equals("石头")) {
System.out.println("恭喜获胜!!!");
}
else{
if(yx.equals(dome)) {
System.out.println("平局!!");
}
else {
System.out.println("你输了!!");
}
}
System.out.print("是否要继续游戏:y/n:");
String num1=input.next();
//判断是否继续游戏
if("y".equals(num1)||"Y".equals(num1)) {
System.out.println("继续游戏");
}
else {
System.out.println("退出游戏");
break;
}
}
}
}