import time import random # Presets player1_score = 0 player2_score = 0 # Get player names player1 = input("What is the first player's name? ") if player1 == "Sherakin": print("Welcome") player2 = input("What is the second player's name? ") if player2 == "Doggy T": print("Yo yo yo Doggy T") # Get number of rounds rounds = input("How many rounds do you want to play? ") while not rounds.isdigit() or not (1 <= int(rounds) <= 3): # Ensure rounds is 1, 2, or 3 print("Send a number of rounds between 1 and 3.") rounds = input("How many rounds do you want to play? ") rounds = int(rounds) # Game loop for round_num in range(rounds): print(f"\n--- Round {round_num + 1} ---") remaining_chips = 10 current_player = player1 while remaining_chips > 0: while True: # Keep asking until a valid number is input try: chips_taken = int(input(f"{current_player}, how many chips (1-3)? ")) if chips_taken < 1 or chips_taken > 3 or chips_taken > remaining_chips: print("Oi, choose between 1 and 3 chips, and no more than remaining chips.") else: break # Exit loop if valid input except ValueError: print("Please enter a valid number between 1 and 3.") remaining_chips -= chips_taken print(f"Chips remaining: {remaining_chips}") if remaining_chips == 0: if current_player == player1: player1_score += 1 else: player2_score += 1 print(f"{current_player} wins the round!") break # Switch players current_player = player2 if current_player == player1 else player1 # Display scores after each round print(f"Scores: {player1}: {player1_score}, {player2}: {player2_score}") # Final result after all rounds if player1_score > player2_score: print(f"{player1} wins the game!") elif player2_score > player1_score: print(f"{player2} wins the game!") else: print("The game is a tie!")