#-------------------------------------- #project: Take Away #standard: Te PUNGA - programming Assessment #school: TBC #Author: Cody Smeed #Date: 25/03/2024 #python: 3.9.13 #-------------------------------------- import random #intro print("Hello test subject what are your names") player1 = input("player 1 name ") player2 = input("player 2 name ") while True: rounds = int(input("and how many rounds would you like to play max is 5 ")) if rounds > 5: print("sorry too much ") else: break #setup maxchip = 21 roundsplayed = 0 score1 = 0 score2 = 0 #game while roundsplayed < rounds: chipsleft = maxchip player = random.randint(1,2) while chipsleft > 0: print(chipsleft) print(player) #limit on how many chips while True: chipstaken = int(input("take 1 to 3 chips ")) if chipstaken > 3: print("that too many take 1 2 or 3 please ") else: break #chips taken if chipstaken == 1: chipsleft = chipsleft - chipstaken player += 1 elif chipstaken == 2: chipsleft = chipsleft - chipstaken player += 1 else: chipsleft = chipsleft - chipstaken player += 1 #change players if player > 2: player -= 2 print("next player") else: print("next player") #show who wins if chipsleft == 0 and player == 1: print("{} is the winner" .format(player1)) rounds -= 1 elif chipsleft == 0 and player == 2: print("{} is the winner" .format(player2)) rounds -= 1 else: print("play on") #check if there rounds left if rounds == 0: print("thanks for playing") break else: print("new round")