//刚学习java,老师布置的一个比较简单的程序
//如果有任何问题可以提出讨论
import java.util.Random;
import java.util.Scanner;
public class Guess_Game {
public static void main(String[] args) {
String zero = "scissor.";
String one = "rock.";
String two = "paper.";
Scanner sc = new Scanner(System.in);
System.out.println("scissor (0),rock (1),paper (2): ");
int yourGuess = sc.nextInt();
Random random = new Random();
int computerGuess = random.nextInt(3);
System.out.println("The computer guess is " + computerGuess);
if (yourGuess == computerGuess) {
if (computerGuess == 0) {
String str = "scissor";
System.out.println("The computer is " + str + "you are scissor too. It is a draw ");
return;
}
if (computerGuess == 1) {
String str = "rock";
System.out.println("The computer is " + str + "you are scissor too. It is a draw ");
return;
}
if (computerGuess == 2) {
String str = "paper";
System.out.println("The computer is " + str + "you are scissor too. It is a draw ");
return;
}
}
if (yourGuess == 0) {
if (computerGuess == 1) {
System.out.println("The computer is " + one + " you are " + zero + "You lost");
}
if (computerGuess == 2) {
System.out.println("The computer is " + two + " you are " + zero + "You win");
}
}
if(yourGuess == 1){
if (computerGuess == 0) {
System.out.println("The computer is " + zero + " you are " + one + "You win");
}
if (computerGuess == 2) {
System.out.println("The computer is " + two + " you are " + one + "You lost");
}
}
if(yourGuess == 2){
if (computerGuess == 0) {
System.out.println("The computer is " + zero + " you are " + two + "You lost");
}
if (computerGuess == 1) {
System.out.println("The computer is " + one + " you are " + two + "You win");
}
}
}
}