""" ------------------------------------------------- Project: 21 Game Standard: 91883 (AS.7) v.1 School: Tauranga Boys' College Author: Kingitone Date: March 2025 Python: 3.7.4 ------------------------------------------------- """ import random import time # Constants MAX_CHIPS = 21 # Player Scores PLAYERONESSCORE = 0 PLAYERTWOSCORE = 0 # Game Var chipsleft = 0 chipsTaken = 1 print("ha'u to the first round ") round_number = 1 #Get players name name = input("Enter Player_name1") name = input ("Enter Player_name2") # Get number of rounds while true: try: rounds = int(input("How many rounds do you want to play(1-5)?")) if 1 <= rounds <= 5: break else: print("Pick a number siko") except ValueError: print("Invalid input ! Please eneter a number") # Game Loop for rounds for round_num in range(1, rounds + 1) print(f"\nRound {round_num}") chipsleft = MAX_CHIPS # Reset chips at the start of each round while chipsleft > 0: #Player 1's turn print(f"\n{name1} wins this round") player1_take = int(input(f"{name1}, how many chips would you like to take (1-3)")) if 1 <= player1_take <= 3: chipsleft -= player1_take print(f"{name1}took {palyer1_take} chips. {chipsleft} chips remaining ") else: print("Invalid input! please choose between 1 and 3") if chipsleft <= 0: print(f"{name1} wins this round") PLAYERONESSCORE += 1 break # Player 2's turn print(f"\n{name2}, how many chips would you like to take (1-3)") player1_take = int(input(f"{nam21}, how many chips would you like to take (1-3)")) if 1 <= player1_take <= 3: chipsleft -= player1_take print(f"{name2}took {palyer2_take} chips. {chipsleft} chips remaining ") else: print("Invalid input! please choose between 1 and 3") if chipsleft <= 0: print(f"{name2} wins this round") PLAYERTWOSCORE += 1 break # End Of Game Summary print("\nGame Over!") if PLAYERONESSCORE > PLAYERTWOSCORE: print(f"{name1} wins the game with {PLAYERONESSCORE} points!") elif PLAYERONESSCORE < PLAYERTWOSCORE: print(f"{name2} wins the game with {PLAYERONESSCORE} points!") else: print("Its a tie!")