Question: import random ROCK = 0 PAPER = 1 SCISSORS = 2 # Read random seed to support testing ( do not alter ) and starting
import random ROCK PAPER SCISSORS # Read random seed to support testing do not alter and starting credits seed intinput # Set the seed for random random.seedintseed # Step : Read player names and number of rounds player input player input rounds intinput # Validate rounds input while rounds : printRounds must be rounds intinput # Output player names and number of rounds printfplayer vs player for rounds rounds" # Initialize win counters playerwins playerwins # Step : Start the game for the specified rounds for in rangerounds: playerchoice random.randint # : Rock, : Paper, : Scissors playerchoice random.randint if playerchoice playerchoice: printTie else: if playerchoice ROCK: if playerchoice SCISSORS: printfplayer wins with rock" playerwins else: printfplayer wins with paper" playerwins elif playerchoice PAPER: if playerchoice ROCK: printfplayer wins with paper" playerwins else: printfplayer wins with scissors" playerwins elif playerchoice SCISSORS: if playerchoice PAPER: printfplayer wins with scissors" playerwins else: printfplayer wins with rock" playerwins # Output total wins printfplayer wins playerwins and player wins playerwins Please fix the above code so it adheres to the following directions: Program Specifications Write a program to play an automated game of Rock, Paper, Scissors. Two players make one of three hand signals at the same time. Hand signals represent a rock, a piece of paper, or a pair of scissors. Each combination results in a win for one of the players. Rock crushes scissors, paper covers rock, and scissors cut paper. A tie occurs if both players make the same signal. Use a random number generator of or to represent the three signals. Note: this program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress. Step Read starter template and do not change the provided code. Variables are defined for ROCK, PAPER, and SCISSORS. A seed is read from input to initialize the random number generator. This supports automated testing and creates predictable results that would otherwise be random. Step pts Read two player names from input str Read number of rounds from input. Continue reading number of rounds if value is below one and provide an error message. Output player names and number of rounds. Submit for grading to confirm tests pass. Ex: If input is: Anna Bert Sample output is: Rounds must be Rounds must be Anna vs Bert for rounds Step pts Use random.randint to generate random values for player followed by player Continue to generate random values for both players until both values do not match. Output "Tie" when the values match. Submit for grading to confirm tests pass. Ex: If input is: Anna Bert Sample output is: Anna vs Bert for rounds Tie Tie Step pts Identify winner for this round and output a message. Rock crushes scissors, scissors cut paper, and paper covers rock. Submit for grading to confirm tests pass. Ex: If input is: Anna Bert Sample output is: Anna vs Bert for rounds Tie Bert wins with rock Step pts Add a loop to repeat steps and for the number of rounds. Output total wins for each player after all rounds are complete. Submit for grading to confirm all tests pass. Ex: If input is: Anna Bert Sample output is: Anna vs Bert for rounds Tie Bert wins with rock Tie Bert wins with rock Tie Anna wins with paper Anna wins and Bert wins
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
