""" ------------------------------------------------- Project: Take-Away Game Standard: 91883 (AS1.7) v.1 School: Tauranga Boys' College Author: Sean Lois Bencio Date: 14/03/2025 Python: 3.5 ------------------------------------------------- """ import random MAX_CHIPS = 21 #The total of chips at the start of each round player1_wins = 0 #The total of Player1's win player2_wins = 0 #The total of Player2's win remaining_chips = 0 #The number of chips remaining chips_taken = 0 #Number of chips taken by other players print("Enter the names of the players.") p1_name = input("Player 1: ") #Player 1's name p2_name = input("Player 2: ") #Player 2's name rounds_count = int(input("How many rounds would you like to play? ")) #The number of rounds current_player = random.choice([p1_name, p2_name]) while rounds_count > 0: remaining_chips = MAX_CHIPS #Resetting the chips at the start of each round print("\nStarting new round...\n") print(current_player + " starts the round!") while remaining_chips > 0: print("Chips left:", remaining_chips) chips_taken = int(input(current_player + ", how many chips would you like to take? (1-3): ")) if chips_taken < 1 or chips_taken > 3: print("Please take between 1 and 3 chips.") continue remaining_chips -= chips_taken print("Chips left after " + current_player + "'s turn: " + str(remaining_chips)) if remaining_chips <= 0: if current_player == p1_name: player1_wins += 1 print(p1_name + " wins this round!") else: player2_wins += 1 print(p2_name + " wins this round!") break current_player = p1_name if current_player == p2_name else p2_name rounds_count -= 1 #Reducing the number of rounds left to play #Showing that the game is over print("\nGame Over!") print("Final Scores:") print(p1_name + ": " + str(player1_wins) + " | " + p2_name + ": " + str(player2_wins)) if player1_wins > player2_wins: print(p1_name + " wins the game!")#Player 1 wins the game elif player2_wins > player1_wins: print(p2_name + " wins the game!")#Player 2 wins the game else: print("It's a draw! Well played!")#Both players got tied