""" ------------------------------------------------- Project: Take-Away Game Standard: 91883 (AS1.7) v.1 School: Tauranga Boys' College Author: YOUR FULL NAME Date: THE DATE YOU COMPLETED THE CODE Python: 3.5 ------------------------------------------------- """ # This program allows two players to go against each other in a classic game of take away. # The winning conditions are that print ("꧁༺ 𝔀𝓮𝓵𝓬𝓸𝓶𝓮 𝓽𝓸 𝓽𝓪𝓴𝓮 𝓪𝔀𝓪𝔂 𝓰𝓪𝓶𝓮! ༻꧂") MAX_CHIPS = 21 PlayerOneScore = 0 PlayerTwoScore = 0 playerOneName = input("Enter Player One's name: ") playerTwoName = input("Enter Player Two's name: ") rounds = int(input("Enter the number of rounds: ")) while rounds > 0: chipsLeft = MAX_CHIPS while chipsLeft > 0: print("Chips left:", chipsLeft) while True: player1_chips_taken = int(input(f"{playerOneName}, choose how many chips to take (1-3): ")) if 1 <= player1_chips_taken <= 3 and player1_chips_taken <= chipsLeft: break else: print("Invalid input. Please choose a number between 1 and 3, and make sure it doesn't exceed the remaining chips.") chipsLeft -= player1_chips_taken if chipsLeft < 1: PlayerOneScore += 1 print(f"{playerOneName} wins this round!") break print("Chips left:", chipsLeft) while True: player2_chips_taken = int(input(f"{playerTwoName}, choose how many chips to take (1-3): ")) if 1 <= player2_chips_taken <= 3 and player2_chips_taken <= chipsLeft: break else: print("Invalid input. Please choose a number between 1 and 3, and make sure it doesn't exceed the remaining chips.") chipsLeft -= player2_chips_taken if chipsLeft < 1: PlayerTwoScore += 1 print(f"{playerTwoName} wins this round!") break rounds -= 1 if PlayerOneScore > PlayerTwoScore: print(f"{playerOneName} wins the game with {PlayerOneScore} round(s) won!") elif PlayerTwoScore > PlayerOneScore: print(f"{playerTwoName} wins the game with {PlayerTwoScore} round(s) won!") else: print("It's a tie!")