Importjava.security.acl.Permission; Public classstartguess {Permission Jia; Comparator Yi; intcount; Public voidinitial () {Jia=NewPerson (); Yi=Newcomputer (); Count= 0; } Public voidshowout12 () {initial (); System.out.println ("----------welcome into the game world-----------"); System.out.println ("**********************************"); System.out.println ("* * * * scissors, start * * *"); System.out.println ("**********************************"); System.out.println ("Punching rule: 1. Scissors 2. Stone 3. Cloth"); System.out.println ("Please select the opponent's role (1: Liu Bei 2: Sun Quan 3: Caocao):"); Scanner input=NewScanner (system.in); inth =Input.nextint (); Switch(h) { Case1: Yi.name= "Liu Bei"; Break; Case2: Yi.name= "Sun Quan"; Break; Case3: Yi.name= "Caocao"; Break; } System.out.println ("Please enter your name:"); Jia.name=Input.next (); System.out.println ("You have chosen" + Yi.name + "PvP"); System.out.println ("Do you want to start? y: Yes N: No"); String Con=Input.next (); while(Con.equals ("Y")) { intper; intcom; if(Con.equals ("Y") ) {per=jia.showout (); COM=yi.showout11 (); if((per = = 1 && com = = 1) | | (per = = 2 && com = = 2) || (per = = 3 && com = = 3) {System.out.println ("Result: the draw, really sucks!"); } Else if((per = = 1 && com = = 3) | | (per = = 2 && com = = 1) || (per = = 3 && com = = 2) {System.out.println ("The result: Congratulations, you won!"); Jia. Score++; } Else{System.out.println ("The result says: ^_^, you lose, really stupid!"); Yi. Score++; } Count++; } System.out.println ("Whether to proceed to the next round. Y: Yes N: No"); Con=Input.next (); } showgg (); } Public voidShowgg () {System.out.println ("-----------------------------"); System.out.println (Jia.name+ "VS" +yi.name); System.out.println ("PvP Times:" +count); System.out.println ("Name" + "\ T" + "integral"); System.out.println (Jia.name+ "\ T" +Jia. Score); System.out.println (Yi.name+ "\ T" +Yi. Score); if(Jia.) Score >Yi. Score) {System.out.println ("A win."); } Else if(Jia.) Score <Yi. Score) {System.out.println ("B wins."); System.out.println ("-----------------------------"); } } }
Man-Machine Scissors