#------------------------------------------------- #Project: Take-Away Game #Standard: 91883 (AS1.7) v.1 #School: Tauranga Boys' College #Author: Cooper Willoughby #Date: THE DATE YOU COMPLETED THE CODE #Python: 3.5 #------------------------------------------------ #Inport libraries import random import time #variables of player score p1_score=0 p2_score=0 #variables on How many round that have been played roundsplayed=1 #variables of how many chips that have been taken and how many chips the players have chips_taken=0 maxschip=21 p1_chips_taken=0 p2_chips_taken=0 #variables of the number the players have pick p1_number="" p2_number="" #Variable of how many chips are left chipsleft=maxschip #To find out the players name name1=input("What is you name player 1:") name2=input("What is you name player 2:") #To find out how many rounds they want to play rounds=int(input("How, many rounds do you want to play?:")) #Intro print("Hello", name1,"and",name2,"this is the pick up game") #If you want to hear the rules yes=input("do you want to hear the rulse of the game, yes(y) or no(n)") if yes=="y": print("You get to pick 1 to 3 chips.") time.sleep(2) print("But you want to get the last chip,") time.sleep(2) print("if you dont then you lose") time.sleep(2) print("Justs saying player one always start") #If you do not want to hear the rules else: print("Well good luck") #It start the rounds while roundsplayed <= rounds: print("round:",roundsplayed) chipsleft=maxschip #Your stats while chipsleft>1: print("Your stats") print("you are in round {} ".format(roundsplayed)) print(name1,"has got {} chips taken".format(p1_chips_taken)) print(name2,"has got {} chips taken".format(p2_chips_taken)) print("This is how many chps are left {}".format(chipsleft)) time.sleep(2) #This is for player one to make his choices for what he can do print("its",name1,"turn") p1_number= int(input("Ok pick a number between 1 and 3:")) chipsleft = chipsleft - p1_number p1_chips_taken = p1_chips_taken + p1_number #To see if Player 1 won the round or not if chipsleft<2: p1_score+=1 print("Good job",name1,"you won this round") if chipsleft <2: break #This for player 2 to make thier choice print("its",name2,"turn" ) p2_number= int(input("Ok pick a number between 1 and 3:")) chipsleft = chipsleft - p2_number p2_chips_taken = p2_chips_taken + p2_number #To see if Player 2 won the round or not if chipsleft<2: p2_score+=1 print("Good job",name2, "you won this round") if chipsleft <=1 : roundsplayed+=1 #The ending code of saying who has won print(name1,"score is {}".format(p1_score)) print(name2,"score is {}".format(p2_score)) #To see who wins if p1_score > p2_score: print(name1, "has won") elif p2_score > p1_score: print(name2,"You have won") #If it is a tie else: print("It is a tie")