I made it assign a value for each "Rock" "Paper" and "Scissors" works great now thanks for the help
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Rock_Paper_Scissors {
private int stage = 0;
static BufferedReader stdin = new BufferedReader
(new InputStreamReader(System.in));
private int random(int range) {
return (int) ((java.lang.Math.random() * range) + 1);
}
public int getPlayerValue(String choice) {
if (choice.equalsIgnoreCase("rock")) {
return 1;
} else if (choice.equalsIgnoreCase("paper")) {
return 2;
} else if (choice.equalsIgnoreCase("scissors")) {
return 3;
}
return 0;
}
public static void main(String[] args) throws IOException {
Rock_Paper_Scissors rps = new Rock_Paper_Scissors();
while (true) {
if (rps.stage == 0) {
System.out.println("Type 'Rock' 'Paper' or 'Scissors'.");
rps.stage++;
rps.handleChoice(stdin.readLine());
}
}
}
public void handleChoice(String choice) {
int compValue = random(3);
if (compValue != getPlayerValue(choice)) {
if (compValue == 1 && getPlayerValue(choice) == 3) { // Rock beating Scissors (computer)
System.out.println("Rock beats Scissors, you lose :(");
}
if (compValue == 2 && getPlayerValue(choice) == 1) { // Paper beating Rock (computer)
System.out.println("Paper beats Rock, you lose :(");
}
if (compValue == 3 && getPlayerValue(choice) == 2) { // Scissors beating Paper (computer)
System.out.println("Scissors beats Paper, you lose :(");
}
if (compValue == 1 && getPlayerValue(choice) == 2) { // Paper beating rock (player)
System.out.println("Paper beats Rock, you win!");
}
if (compValue == 2 && getPlayerValue(choice) == 3) { // Scissors beating paper (player)
System.out.println("Scissors beats paper, you win!");
}
if (compValue == 3 && getPlayerValue(choice) == 1) { // Rock beating Scissors (player)
System.out.println("Rock beats Scissors, you win!");
}
} else {
System.out.println("You tied!");
}
stage = 0;
}
}
Thanks Again!