人机 猜 拳

package com.company;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
    while (true) {
    System.out.println("*******************************");
    System.out.println("--------欢迎进入猜拳游戏--------");
    System.out.println("请出拳:(1是剪刀,2是石头,3是布)");
    Scanner sc=new Scanner(System.in);
    int person=sc.nextInt();
    int computer=(int)(Math.random()*3)+1;
    String per="用户";
    String com = "电脑";

    switch(person){
        case 1:
            per="剪刀";
            break;
        case 2:
            per="石头";
            break;
        case 3:
            per="布";
            break;
    }

    switch(computer){
        case 1:
            com="剪刀";
            break;
        case 2:
            com="石头";
            break;
        case 3:
            com="布";
            break;
    }

    if(person==1&&computer==

你可能感兴趣的:(人机 猜 拳)