import java.util.Scanner;

import java.util.Random;

public class Hello {

     public static int judge(int j, int k)

          {

              int m;

              if(j==k) m=0;

              else if(j==0&&k==2||j==1&&k==0||j==2&&k==1) m=1;

              else m=2;

              return m;       

          }

   public static void main(String[] args) {

          

        System.out.println("scissor(0),rock(1),paper(2)");

        System.out.println("Please Input Your Choose:");

        int a=0,b=0;

        Scanner input = new Scanner(System.in);

       

         while(a!=2&&b!=2)

         {

      

            int Choose = input.nextInt();

            int number = new Random().nextInt(3);

            

if (judge(Choose,number)==0)

{System.out.println("平手,please continue competition");

continue;}

             else if(judge(Choose,number)==1)

{ System.out.println("You win this time,please continue competition");

a++;}

             else if(judge(Choose,number)==2)

{ System.out.println("You are defeabed this time,please continue competition");

b++;

}

         }

         if(a==2) 

               System.out.println("You Win Last");

         else if(b==2)

             System.out.println("Computer Win Last");

   }

}

最新文章

  1. [Java] Maven 建立 Spring MVC 工程
  2. 移动端图片上传解决方案localResizeIMG先压缩后ajax无刷新上传
  3. mongodb版本特性
  4. 2016HUAS_ACM暑假集训2B - The Suspects(感染者)
  5. 06SpringMvc_适配器
  6. winston日志管理2
  7. 使用Yii框架自带的CActiveForm实现ajax提交表单
  8. 【PHP代码审计】 那些年我们一起挖掘SQL注入 - 3.全局防护Bypass之Base64Decode
  9. iOS开发:告诉git不要跟踪UserInterfaceState.xcuserstate
  10. ARM中的PC和AXD的PC
  11. js写的简单轮播图
  12. 获取客户端IPAsp.Net
  13. poj_3468: A Simple Problem with Integers (树状数组区间更新)
  14. mysql错误集锦
  15. Python 上下文管理协议中的__enter__和__exit__基本理解
  16. 前端(一)之 HTML
  17. Eclipse Java EE IDE for Web Developers集成的Maven 3 指向自己安装的 Maven
  18. IDEA从SVN中导入多模块项目
  19. GO-time.after 用法
  20. 【读书笔记】iOS-网络-使用Bonjour实现自组织网络

热门文章

  1. Pie(二分)
  2. xml转换成数组array
  3. 【DP】编辑距离
  4. 关于网站图片格式 png,jpg,
  5. php实时推送系统消息给客户端
  6. Windows phone开发之文件夹与文件操作系列(一)文件夹与文件操作
  7. JDBC的详细使用
  8. 【sqli-labs】 less10 GET - Blind - Time based. - Double quotes (基于时间的双引号盲注)
  9. Python标准模块--logging(转载)
  10. C#连接Oracle数据库的方法(System.Data.OracleClient、Oracle.DataAccess.Client也叫ODP.net、Oracle.ManagedDataAccess.dll)