""" ------------------------------------------------- Project: Take-Away Game Standard: 91883 (AS1.7) v.1 School: Tauranga Boys' College Author: JORDAN RICHARDS Date: THE DATE YOU COMPLETED THE CODE Python: 3.11.9 ------------------------------------------------- """ """21 GAME, EACH PLAYER TAKES UP TO 3 CHIPS UNTIL IT REACHES ZERO, WHOEVER TAKES THE LAST CHIP WINS""" max_chips = 21 player1score = 0 player2score = 0 chipsleft = max_chips player1 = input("What is your name, Player 1? -> ") player2 = input(f"Hi {player1}, now what is Player 2's name? -> ") while chipsleft > 0: print(f"\nChips left: {chipsleft}") # Player 1's turn chipstaken1 = int(input(f"{player1}, how many chips will you take (1 to 3)? ")) if 1 <= chipstaken1 <= 3 and chipstaken1 <= chipsleft: # Input validation chipsleft -= chipstaken1 if chipsleft < 1: player1score += 1 print(f"Congratulations {player1}, you won!") break else: print(f"Invalid input. You can only take 1 to 3 chips and not more than remaining chips.") continue # Go back to the start of the loop if input is invalid print(f"Chips left: {chipsleft}") # Player 2's turn chipstaken2 = int(input(f"{player2}, how many chips will you take (1 to 3)? ")) if 1 <= chipstaken2 <= 3 and chipstaken2 <= chipsleft: # Input validation chipsleft -= chipstaken2 if chipsleft < 1: player2score += 1 print(f"Congratulations {player2}, you won!") break else: print(f"Invalid input. You can only take 1 to 3 chips and not more than remaining chips.") continue # Go back to the start of the loop if input is invalid print(f"Final Score: {player1}: {player1score}, {player2}: {player2score}")