Question
I need assistance with the following code in matlab. Please help! Implement Rock-Paper-Scissors such that the user can play the computer in a best-of series!
I need assistance with the following code in matlab. Please help!
Implement Rock-Paper-Scissors such that the user can play the computer in a best-of series! The user inputs the number of rounds which should be positive and odd. This is a free form assignment but structure your code similar to the test cases provided.
Program Inputs How many rounds would you like to play (odd rounds only)?:
XXX XXX should be positive and odd.
Restart the game if the input is not positive or odd.
Program Outputs XXX wins this round
Replace XXX with either User or Computer depending on who wins the round Game Over!
After the Game is over display the times User and Computer won after the total number of rounds. Finally display who wins the entire game
Test Case 1:
Welcome to Rock-Paper-Scissors!
Play if you dare! How many rounds would you like to play (odd rounds only)?
3 You choose to do best out of 3 rounds
*********************************************************
Round 1
*********************************************************
Rock (0)... Paper (1)... Scissors (2)... Shoot: 1
The computer chooses Rock and you picked Paper User wins this round!
********************************************************* *********************************************************
Round 2 *********************************************************
Rock (0)... Paper (1)... Scissors (2)... Shoot: 2
The computer chooses Rock and you picked Scissors Computer wins this round!
********************************************************* *********************************************************
Round 3
*********************************************************
Rock (0)... Paper (1)... Scissors (2)... Shoot: 1
The computer chooses Scissors and you picked Paper Computer wins this round!
********************************************************* *********************************************************
Game over! User won 1 out of 3 rounds Computer won 2 out of 3 rounds Computer wins! Did you expect anything else?
*********************************************************
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started