""" ------------------------------------------------- Project: pick up game Standard: TE PUNGA Programming Assessment School: Tauranga Boy's College Author: jake conder Date: March 2024 Python: 3.11.9 ------------------------------------------------- """ import time #constant MAX_CHIPS = 21 # changing variables Chips = 21 Rounds = 0 Player1_score = 0 Player2_score = 0 print("welcome to the pick up game!!!!!!!!!") #printing game name # asking for player 1 and 2's name and checking that they are real names while True: name1 = input("what is your name player1? ") if name1.isalpha() == True: break else: print("that is not a real name, unless your dad is elon musk ") while True: name2 = input(" and what is your name player2? ") if name2.isalpha() == True: break else: print(" that is not a real name, unless your dad is elon musk ") print(f" {name1} and {name2}, welcome to the game You have {MAX_CHIPS} chips between the two of you to play this game") time.sleep(1) # asking how many rounds to play and checking that they are what is asked between 1-5 while True: try: Rounds = int(input('How many rounds would you like to play? 1-5: ')) if Rounds < 1 or Rounds > 5: print("Please select a number between 1 and 5.") else: break except ValueError: print("You didn't even put a number How do you expect this game to work?") print(f"Alright best of {Rounds} rounds to win") # Game loop turn = 1 while Rounds > 0: chips_left = Chips print(f"new round {chips_left} chips left") while chips_left > 0: print(f"Chips left: {chips_left}") if turn == 1: print(f"{name1}s turn") else: print(f"{name2}s turn") try: chips_taken = int(input('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.") else: chips_left -= chips_taken if chips_left <= 0: print(f"{name1 if turn == 1 else name2} wins this round") if turn == 1: Player1_score += 1 else: Player2_score += 1 break turn = 2 if turn == 1 else 1 except ValueError: print("that is not a number dummy. Please enter a number between 1 and 3.") Rounds -= 1 time.sleep(2) # Print the final scores print("Game over") print(f"Final Scores:\n{name1}: {Player1_score}\n{name2}: {Player2_score}") if Player1_score > Player2_score: print(f"Congratulations {name1}, you are the overall winner") elif Player2_score > Player1_score: print(f"Congratulations {name2}, you are the overall winner") else: print("It's a tie") #my code but chat gpt was used to fix the erros like spaming milions of 21 and random errors