Answer:
In Python
print("Instruction: 1. Rock, 2. Paper or 3. Scissors: ")
p1 = int(input("Player 1: "))
p2 = int(input("Player 2: "))
if p1 == p2:
print("Tie")
else:
if p1 == 1: # Rock
if p2 == 2: #Paper
print("P2 wins! Paper covers Rock")
else: #Scissors
print("P1 wins! Rock smashes Scissors")
elif p1 == 2: #Paper
if p2 == 1: #Rock
print("P1 wins! Paper covers Rock")
else: #Scissors
print("P2 wins! Scissors cuts Paper")
elif p1 == 3: #Scissors
if p2 == 1: #Rock
print("P2 wins! Rock smashes Scissors")
else: #Paper
print("P1 wins! Scissors cuts Paper")
Step-by-step explanation:
This prints the game instruction
print("Instruction: 1. Rock, 2. Paper or 3. Scissors: ")
The next two lines get input from the user
p1 = int(input("Player 1: "))
p2 = int(input("Player 2: "))
If both input are the same, then there is a tie
if p1 == p2:
print("Tie")
If otherwise
else:
The following is executed if P1 selects rock
if p1 == 1: # Rock
If P2 selects paper, then P2 wins
if p2 == 2: #Paper
print("P2 wins! Paper covers Rock")
If P2 selects scissors, then P1 wins
else: #Scissors
print("P1 wins! Rock smashes Scissors")
The following is executed if P1 selects paper
elif p1 == 2: #Paper
If P2 selects rock, then P1 wins
if p2 == 1: #Rock
print("P1 wins! Paper covers Rock")
If P2 selects scissors, then P2 wins
else: #Scissors
print("P2 wins! Scissors cuts Paper")
The following is executed if P1 selects scissors
elif p1 == 3: #Scissors
If P2 selects rock, then P2 wins
if p2 == 1: #Rock
print("P2 wins! Rock smashes Scissors")
If P2 selects paper, then P1 wins
else: #Paper
print("P1 wins! Scissors cuts Paper")