RPS/Thecomputer.java

38 lines
1.3 KiB
Java

import java.util.Random;
public class Thecomputer {
static boolean airock = false;
static boolean aipaper = false;
static boolean aiscissors = false; //makes the boolean
public static void generate(String[] args) {
Random random = new Random();
int randomnumber = random.nextInt(3); //makes a random number from 0-2
if(randomnumber == 1) { //if the number is 1 then the computer choose paper and forces the others to be false
aipaper = true;
if(aipaper = true) {
airock = false;
aiscissors = false;
System.out.println("aipaper is true");
}
}
if(randomnumber == 0) { //if the number is 0 then the computer choose scissors and forces the others to be false
aiscissors = true;
if(aiscissors = true) {
airock = false;
aipaper = false;
System.out.println("aiscissors is true");
}
}
if(randomnumber == 2) { //if the number is 2 then the computer choose rock and forces the others to be false
airock = true;
if(airock = true) {
aiscissors = false;
aipaper = false;
System.out.println("airock is true");
}
}
}
}