// rock, paper, scissors
System.out.println("write 'stop' to end the game.");
String input=" ";
do {
System.out.println("Rock, Paper, Scissors shoot!");
Scanner sc = new Scanner(System.in);
input = sc.nextLine();
String[] words = {"rock", "paper", "scissors"};
Random random = new Random();
int randomIndex = random.nextInt(words.length);
String word = words[randomIndex];
System.out.println(word);
if (word.equals(input)) {
System.out.println("It's a tie! Let's play again!");
}
if (input.equals("scissors") && word.equals("paper")) {
System.out.println("You won!");
}
if (input.equals("scissors") && word.equals("rock")) {
System.out.println("You lost!");
}
if (input.equals("rock") && word.equals("scissors")) {
System.out.println("You won!");
}
if (input.equals("rock") && word.equals("paper")) {
System.out.println("You lost!");
}
if (input.equals("paper") && word.equals("rock")) {
System.out.println("You won!");
}
if (input.equals("paper") && word.equals("scissors")) {
System.out.println("You lost!");
}
} while (!input.equals("stop"));
System.out.println("");