""" ------------------------------------------------- Project: Pick up game Standard: TE PUNGA - Programming Assessment School: Tauranga Boys' College Author: Ollie Cartwright Date: March 2025 Python: 3.11.9 ------------------------------------------------- """ MAX_CHIPS = 21 PlayerOneScore = 0 PlayerTwoScore = 0 chipsLeft = 0 chipsTaken = 0 while True: playerOneName = str(input("Player one's name: ")) if playerOneName .isalpha() == True: while True: playerTwoName = str(input("Player two's name: ")) if playerTwoName .isalpha() == True: break else: print("Please enter a valid name, try again.") break else: print("Please enter a valid name, try again.") while True: try: rounds = int(input("How many rounds do you want to play? (Please choose between 1 and 5): ")) if rounds < 1 or rounds > 5: print("Please choose a number between 1 and 5") else: break except: print("You didn't even put a number in how am I supposed to continue the game bro?") while rounds > 0: chipsLeft = MAX_CHIPS while chipsLeft > 0: print(" ") print("There is", chipsLeft, "chips left.") print(" ") while chipsLeft < 4: chipsTaken = int(input("How many chips does " + playerOneName + " want to take? (please choose between 1 and"+ str(chipsLeft) +"): ")) if chipsTaken > chipsLeft or chipsTaken < 1: print("Please choose between 1 and "+chipsLeft) else: break while chipsLeft > 4: chipsTaken = input("How many chips does " + playerOneName + " want to take? (please choose between 1 and 3): ") if chipsTaken .isalpha() == True: print("This input isnt an number") elif int(chipsTaken) < 1 or int(chipsTaken) > 3 : print("Please enter a number thats between 1 and 3") else: break chipsLeft = chipsLeft - int(chipsTaken) if chipsLeft < 1: PlayerOneScore += 1 print(playerOneName + "'s score is " + str(PlayerOneScore)) print(" ") print(playerTwoName + "'s score is " + str(PlayerTwoScore)) break print(" ") print("There is", chipsLeft, "chips left.") print(" ") while chipsLeft < 4: chipsTaken = int(input("How many chips does " + playerTwoName + " want to take? (please choose between 1 and" + str(chipsLeft) + "): ")) if chipsTaken > chipsLeft: print("Please choose between 1 and "+ str(chipsLeft)) else: break while chipsLeft > 4: chipsTaken = input("How many chips does " + playerTwoName + " want to take? (please choose between 1 and 3): ") if chipsTaken .isalpha() == True: print("This input isnt an number") elif int(chipsTaken) < 1 or int(chipsTaken) > 3: print("Please enter a number thats between 1 and 3") else: break chipsLeft = chipsLeft - int(chipsTaken) if chipsLeft < 1: PlayerTwoScore += 1 print(playerOneName + "'s score is " + str(PlayerOneScore)) print(" ") print(playerTwoName + "'s score is " + str(PlayerTwoScore)) break rounds = rounds - 1