import java.util.Scanner;
import java.util.Random;
public class Guess{
public static void main(String[] args){
System.out.println(“请输入数字:1.石头2.剪刀.3布,率先获得两胜结束”);
int computerCount = 0;
int userCount = 0;
for(int i =1;i<=3;){
Scanner scan = new Scanner(System.in);
int user = scan.nextInt();
if((user != 1) && (user != 2) && (user != 3)){
System.out.println(“输入错误,请重新输入”);
continue;
}
Random rand = new Random();
int computer = rand.nextInt(3)+1;
if(user == computer){
System.out.print(“平局”);
continue;
}else if((user == 1 && computer == 2)||(user == 2 && computer == 3)||(user == 3 && computer == 1)){
System.out.println(“大神”);
userCount++;
}else{
System.out.println(“差劲”);
computerCount++;
}
if(userCount == 2 || computerCount == 2){
break;
}
i++;
}
String win = (userCount>computerCount)?“玩家最终胜利”:“电脑最终获胜”;
System.out.println(win);
}
}