""" ------------------------------------------------- Project: Take-Away Game Standard: 91883 (AS1.7) v.1 School: Tauranga Boys' College Author: Dexter Bollen Date: Python: 3.5 ------------------------------------------------- """ import random import time max_chips = 21 p1_chips = 0 p2_chips = 0 p1_score = 0 p2_score = 0 p1_name = str(input("What is your name, player one?")) p2_name = str(input("What is your name, player two?")) #Players input their names while True: try: rounds = int(input("Hello travellers, how many rounds would you like to play? 1-5")) if rounds < 1 or rounds > 5: print("Enter a number from 1 to five, can you count?") #asks the player again for a number 1-5 else: break except: print("That's not a number from 1 to five, can you count?") input("Say sorry.") #Tells the player off for inputting something that is not a number chips_left = max_chips print("There are 21 chips left") time.sleep(2) while chips_left > 0 and rounds > 0: p1chips_taken = int(input("How many chips will you take 1-3")) chips_left -= p1chips_taken if chips_left < 1: p1_score += 1 print(f"There are {chips_left} chips left!") break time.sleep(1) print(p2_name) p2chips_taken = int(input("How many chips will you take 1-3")) chips_left -= p2chips_taken print(f"There are {chips_left} chips left!") if chips_left < 1: p2_score += 1 print(f"There are {chips_left} chips left!") break rounds -= 1 if p1_score > p2_score: print(p1_name) print("You win this round!") elif p2_score > p1_score: print(p2_name) print("You win this round!") else: print("Well well! It's a tie!") if rounds < 1: print("These are the final scores. Congratulations") print(f"{p1_name}: {p1_score}") print(f"{p2_name}: {p2_score}")