You are given a series of rounds, each containing the player's move and the computer's move. Your task is to determine the winner of each round, maintain the running score, and report the overall winner after all rounds are completed.
The game follows these standard rules:
After evaluating all rounds, compare the total wins of both sides to determine the overall winner. If both have the same number of wins, the overall result is a draw.
Input: rounds = [(rock, scissors), (paper, scissors), (rock, rock)]
Output: Round 1: Player, Round 2: Computer, Round 3: Draw - Overall: Draw (1-1)
Explanation: In the first round, the player wins because rock beats scissors. In the second round, the computer wins because scissors beats paper. The third round is a draw because both choose rock. The final score is tied at 1-1.
Input: rounds = [(rock, scissors)]
Output: Round 1: Player - Overall: Player (1-0)
Explanation: Rock beats scissors, so the player wins the only round. The final score is 1-0.
Input: rounds = [(paper, scissors), (rock, paper)]
Output: Round 1: Computer, Round 2: Computer - Overall: Computer (0-2)
Explanation: The computer wins the first round because scissors beats paper and the second round because paper beats rock. The final score is 0-2.
rock, paper, or scissors.Approach, complexity and clean code in every language. Sign in to unlock the editorial.
Your submissions, results and runtime history live here. Sign in to start your streak.
1 rock scissors
Round 1: Player - Overall: Player (1-0)
2 paper scissors rock paper
Round 1: Computer, Round 2: Computer - Overall: Computer (0-2)