This Python program simulates multiple rounds of the Rock, Paper, Scissors game between two players.
Each player chooses one of the following options:
- Scissors → value 1
- Rock → value 2
- Paper → value 3
If both players choose the same option, the round is a draw.
Otherwise, the winner is determined based on the following rules:
- Scissors < Rock → Rock wins
- Rock < Paper → Paper wins
- Paper < Scissors → Scissors wins
# Function to determine winner
def determine_winner(p1, p2):
if p1 == p2:
return "Draw"
elif (p1 == 1 and p2 == 2) or (p1 == 2 and p2 == 3) or (p1 == 3 and p2 == 1):
return "Player 2 wins"
else:
return "Player 1 wins"
# Read number of rounds
n = int(input("Enter number of rounds: "))
# Play each round
for i in range(n):
print(f"\n--- Round {i+1} ---")
p1 = int(input("Player 1 (1=Scissors, 2=Rock, 3=Paper): "))
p2 = int(input("Player 2 (1=Scissors, 2=Rock, 3=Paper): "))
result = determine_winner(p1, p2)
print("Result:", result)
Enter number of rounds: 3
--- Round 1 ---
Player 1: 1
Player 2: 2
Result: Player 2 wins
--- Round 2 ---
Player 1: 2
Player 2: 3
Result: Player 2 wins
--- Round 3 ---
Player 1: 3
Player 2: 1
Result: Player 2 wins
- Each player inputs a number between 1 and 3
- The determine_winner() function applies the game rules to decide the winner
- If both choices are equal, the round is a draw
- Otherwise, the winner is determined based on the combination
- The result is printed for each round