''' ------------------------------------------------- Project: Take away game Standard: 91883 (AS1.7) v.1 School: Tauranga Boys' College Author: Zane levick Date: Python: 3.5 ------------------------------------------------- ''' #import random import random #players choose name and random amount of chips get generated ALLCHIPS = random.randint(10,30) Player_name1 = str(input("What is your name player one? ")) Player_name2 = str(input("What is your name player two? ")) #this asks how many rounds to play Rounds = int(input("Hello {} and {} how many rounds would you like to play? ".format(Player_name1,Player_name2))) #sets the basic varibles roundsPlayed = 0 score1 = 0 score2 = 0 chipsLeft = ALLCHIPS #says who will start the game and how many chips are here # startr of rounds code while Rounds != 0 : if chipsLeft == ALLCHIPS : player = Player_name1 print("You will start {}".format(player)) print("There are {} chips left in the pot".format(chipsLeft)) while chipsLeft != 0 : # while loop on if chips are not at 0 chipstaken = int(input("How many chips Would you like {} ".format(Player_name1))) while chipstaken in (1,2,3): # makes sure that the user is chosing 1,2,3 chips to take chipsLeft = chipsLeft - chipstaken #rermoves the taken chips from the piles chipstaken = 0 else : # if the user enters the wrong number it will return print("invalid number try again") chipstaken = 0 #second players turn print("There are {} chips left in the pot".format(chipsLeft)) chipstaken = int(input("How many chips Would you like {} ".format(Player_name2))) while chipstaken in (1,2,3): chipsLeft = chipsLeft - chipstaken chipstaken = 0 else : print("invalid number try again") chipstaken = 0 # printing the final amont print("There are {} chips left in the pot".format(chipsLeft)) Rounds = Rounds - 1