# WHILE Mini Project — Rock, Paper, Scissors
# while + random + continue — a full match with score tracking

import random

# ─────────────────────────────────────────────
# Setup
# ─────────────────────────────────────────────

choices = "rock paper scissors".split()
rounds = int(input("How many rounds? "))

player_score = 0
computer_score = 0
current_round = 0

# ─────────────────────────────────────────────
# Game loop
# ─────────────────────────────────────────────

while current_round < rounds:
    current_round += 1
    print(f"\nRound {current_round} of {rounds}")

    player = input("rock, paper or scissors? ").lower()
    if player not in choices:
        print("Invalid choice. Round skipped.")
        continue

    computer = random.choice(choices)
    print(f"Computer chose: {computer}")

    if player == computer:
        print("Draw.")
    elif (player == "rock" and computer == "scissors") or \
         (player == "scissors" and computer == "paper") or \
         (player == "paper" and computer == "rock"):
        print("You win this round.")
        player_score += 1
    else:
        print("Computer wins this round.")
        computer_score += 1

# ─────────────────────────────────────────────
# Final verdict
# ─────────────────────────────────────────────

print(f"\nFinal score — You: {player_score} | Computer: {computer_score}")

if player_score > computer_score:
    print("You win the match!")
elif computer_score > player_score:
    print("Computer wins the match.")
else:
    print("It's a draw.")

# ─────────────────────────────────────────────
# Go further
# ─────────────────────────────────────────────

# Add a "best of" message at the start — "Best of 5"
# Stop early if one player can't be caught
# Track draws separately in the final score
