Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Loops COMP 1 6 3 Write a program to play Ro - Sham - Bo . Two players make one of three hand signals at
Loops
COMP
Write a program to play RoShamBo 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.
The Challenge
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.
Variables are defined for ROCK, PAPER, and SCISSORS
Read two player names
Read number of rounds
Continue reading number of rounds if value is below one and provide an error message
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
Input
Seed
Player
Player
Number of rounds
Output
Player vs Player for # rounds
result of round
player wins, player wins
Example
Seed :
Player Name : Bob
Player Name : Sally
Rounds Played :
Bob vs Sally for rounds Tie
Tie
Bob wins with scissors
sally wins with paper
Sally wins with paper
Bob wins and Sally wins
Seed :
Player Name : Bob
Player Name : Salzy
Rounds Played :
Rounds must be
Hint
Use random.randint to generate random values
What to turn in
Loops.py
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