Extend the "rock paper scissors" game to play a tournament. A tournament consists of multiple rounds. The tournament goes on until the user or the computer (CPU) wins two rounds.
The program should print the current number of player wins, CPU wins, and ties after each round. The program should also print the winner of the tournament when it ends.For example (user input in green):
Welcome to 🪨 📜 ✂️ tournament Choose between Rock, Paper, and Scissors: Scissors You chose Scissors. CPU chose: Rock You lose! Your wins: 0. CPU wins: 1. Ties: 0 Choose between Rock, Paper, and Scissors: Rock You chose Rock. CPU chose: Scissors You win! Your wins: 1. CPU wins: 1. Ties: 0 Choose between Rock, Paper, and Scissors: Paper You chose Paper. CPU chose: Paper It's a tie! Your wins: 1. CPU wins: 1. Ties: 1 Choose between Rock, Paper, and Scissors: Rock You chose Rock. CPU chose: Rock It's a tie! Your wins: 1. CPU wins: 1. Ties: 2 Choose between Rock, Paper, and Scissors: Paper You chose Paper. CPU chose: Rock You win! Your wins: 2. CPU wins: 1. Ties: 2 You win the tournament! 🏆 Thanks for playing!
random object once. You can then use the same object to generate random numbers in a loop:
// Some code here
Random random = new Random();
int lowerInclusive = 0;
int upperInclusive = 2;
while (continuePlaying) {
int cpuChoice = random.nextInt(lowerInclusive, upperInclusive + 1);
// More code here
}