""" ------------------------------------------------- Project: Pick up game Standard: TE PUNGA - Programming Assessment School: Tauranga Boys' College Author: Leland Joyce Date: March 2025 Python: 3.9 ------------------------------------------------- """ #Imports import random import time #Constants MAX_CHIPS = 21 #Player score player1_score = 0 # Removed the redundant initialization player2_score = 0 # Added this for player 2 score #Player name input player1_name = input("Enter Player One's name: ") player2_name = input("Enter Player Two's name: ") #Title print("\n\n") time.sleep(0.5) print(""" ██████╗ ██╗ ██████╗██╗ ██╗ ██╗ ██╗██████╗ ██████╗ █████╗ ███╗ ███╗███████╗ ██╔══██╗██║██╔════╝██║ ██╔╝ ██║ ██║██╔══██╗ ██╔════╝ ██╔══██╗████╗ ████║██╔════╝ ██████╔╝██║██║ █████╔╝█████╗██║ ██║██████╔╝ ██║ ███╗███████║██╔████╔██║█████╗ ██╔═══╝ ██║██║ ██╔═██╗╚════╝██║ ██║██╔═══╝ ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ ██║ ██║╚██████╗██║ ██╗ ╚██████╔╝██║ ╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ """) time.sleep(2) print("\033c", end="") #clears the title #Ask for number of rounds to play rounds = int(input("Enter the number of rounds you want to play:1-5 ")) #Main game loop while rounds > 0: chips_left = MAX_CHIPS #Reset chips each round print(f"\n --- Round {21 - rounds + 1} --- ") #Start the round until no chips are left while chips_left > 0: #Player 1 turn print(f"Chips left: {chips_left}") player1_chips = int(input(f"{player1_name}, how many chips will you take (1, 2, or 3)? ")) if player1_chips < 1 or player1_chips > 3: print("Not a number you can use! You can only choose 1, 2, or 3 chips.") continue #Invalid input chips_left -= player1_chips if chips_left <= 0: player1_score += 1 print(f"{player1_name} wins") break #Player 2 turn print(f"Chips left: {chips_left}") player2_chips = int(input(f"{player2_name}, how many chips will you take (1, 2, or 3)? ")) if player2_chips < 1 or player2_chips > 3: print("Not a number you can use! You can only choose 1, 2, or 3 chips.") continue #invalid input chips_left -= player2_chips if chips_left <= 0: player2_score += 1 print(f"{player2_name} wins") break rounds -= 1 #Round Decrease #Shows final scores print("\nFinal Scores") print(f"{player1_name}: {player1_score}") print(f"{player2_name}: {player2_score}") #Shows game winner if player1_score > player2_score: print(f"{player1_name} wins the game! Congratulations!") elif player2_score > player1_score: print(f"{player2_name} wins the game! Congratulations!") else: print("It's a tie!")