""" ------------------------------------------------- Project: Take away game Standard: 91883 (AS1.7) v.1 School: Tauranga Boys' College Author: Hayden Kent Date: 22/03/2024 Python: 3.11.0 64-bit ------------------------------------------------- """ import time import random friendy = True print("Welcome to the take away game!") #'Just a bit of funny comedy before game starts just so it can remind you to play with someone.' time.sleep(2) while friendy == True : Friend = input("Now do you have a friend to play this with?(Y/N)") if Friend.lower() == "y" : print("Ok lets begin!") friendy = False time.sleep(1) #The code for naming the players name1=input("Player one what is your name?") print("Please remember that you are number one", name1) time.sleep(3) name2=input("Player two what is your name?") print("Remember that you are number two", name2) #'Game values which will be changed or set back to the original number at the end ov every round the tot variables show off your overall score! round on is the looping variable for the whole game' P1chips = 0 P2chips = 0 ChipNum = 21 RoundOn = True p1win = 0 p2win = 0 take1= 0 take2= 0 Roundcount = 1 onetot = 0 twotot = 0 "The rules of the game if you didn't know already" print("the rules are simple the winner of the round is counted by who has the most chips out of the stack of 21") time.sleep(5) print("The winner is calculated by who has the most chips but if you are the one who took the last chip you will lose 5 of your points") time.sleep(5) print("You can choose to take 1-3 chips every round, Player one starts but after that every round will be losers turn first. If you get caught taking none or above three chips your turn will be handed over to the opposite opponent every three times you get caught cheating it will result in a automatic loss of the round ") time.sleep(8.5) print("Hopefully the rules are simple so no you two can begin!") time.sleep(2.5) #The place where you choose the amount of rounds Roundamount = int(input("How many round do you wish to play?(1-Infinite)")) time.sleep(2) #the thing that makes you auto lose if you cheat cheat_strike1 = 1 cheat_strike2 = 1 #The main loop which hopefully has the whole game in #The loop runs like normal #choice1 and 2 is the variable for each player choosing their numbers while RoundOn == True : print("Current round", Roundcount) time.sleep(2.5) print("There are", ChipNum, "chips left") time.sleep(2) Choice1 = int(input("Player one :How many chips do you want to take?(1-3)")) time.sleep(2) if Choice1 > 3 : print("That is not a valid choice because i caught you cheating it is your opponents turn.") time.sleep(3) cheat_strike1 += 1 print("Sorry", name1, "Play stupid games win stupid prizes!") if cheat_strike1 == 4 : print("Sorry buddy but you stiked 3 times so it is", name2, "who wins this round and starts next round") P1chips -= 10 if ChipNum == 1 : print("There is only one chip so you automaticly take it!") time.sleep(2) Chipnum = 0 onetot += 1 P1chips += 1 if ChipNum < 2 : if Choice1 == 1 and 2 and 3 : ChipNum -= Choice1 onetot += Choice1 P1chips += Choice1 if ChipNum > 2 : Choice1 = int(input("Wait a second! There are only two chips left do you take one or the other?(1-2)")) if Choice1 < 2 : print("That is not a number due to that it is a handover to the opponent") if Choice1 > 2 : print("so you took", Choice1) Chipnum -= Choice1 onetot += Choice1 P1chips += Choice1 if ChipNum < 0 : print("Print the results of this round are in!") time.sleep(2) print("P1 Has", P1chips, "chips") time.sleep(2) print("P2 has", P2chips, "chips") time.sleep(2) print("P1 Was the last person to take a chip so we have to minus his points by %10") time.sleep(3) P1chips -= 5 print("Their updated score is", P1chips) if P1chips > P2chips : print(name1, "wins this round!") p1win += 1 Roundcount += 1 cheat_strike2 = 1 cheat_strike1 = 1 if P1chips < P2chips : print(name2, "wins this round!") p2win += 1 Roundcount += 1 cheat_strike1 = 1 cheat_strike2 = 1 time.sleep(3) ChipNum == 21 if Roundcount > Roundamount : print("The round is over and the results are already in!") time.sleep(3) print("The winner is someone who has tried very hard!") time.sleep(3.5) print("They are also devilously handsome!") time.sleep(3) if p1win < p2win : print("It is", name2,"!") time.sleep(2) print("They won with the lead of", p2win, "Wins!") time.sleep(2) print("Throughout the whole rounds they gained", twotot, "chips overall!") time.sleep(3) print("Thank you for playing please come and play again!") break if p1win > p2win : print("It is", name1,"!") time.sleep(2) print("They won with the lead of", p1win, "Wins!") time.sleep(2) print("Throughout the whole rounds they gained", onetot, "chips overall!") time.sleep(3) print("Thank you for playing please come and play again!") break print("Current round", Roundcount) time.sleep(2.5) print("There are", ChipNum, "chips left") time.sleep(2) Choice2 = int(input("Player two: How many chips do you want to take?(1-3)")) time.sleep(2) if Choice2 > 3 : print("That is not a valid choice because i caught you cheating it is your opponents turn.") time.sleep(3) cheat_strike2 += 1 print("Sorry", name2, "Play stupid games win stupid prizes!") if cheat_strike2 == 4 : print("Oh wait! because you stiked 3 times so it is", name1, "who wins this round and starts next round") P2chips -= 10 if ChipNum == 1 : print("There is only one chip so you automaticly take it!") time.sleep(2) Chipnum = 0 twotot += 1 P2chips += 1 if ChipNum < 2 : if Choice2 == 1 and 2 and 3 : ChipNum -= Choice2 onetot += Choice2 P2chips += Choice2 if ChipNum > 2 : Choice2 = int(input("Wait a second! There are only two chips left do you take one or the other?(1-2)")) if Choice2 < 2 : print("That is not a number due to that it is a handover to the opponent") if Choice2 > 2 : print("so you took", Choice2) Chipnum -= Choice2 twotot += Choice2 P2chips += Choice2 if ChipNum < 0 : print("the results of this round are in!") time.sleep(2) print("P1 Has", P1chips, "chips") time.sleep(2) print("P2 has", P2chips, "chips") time.sleep(2) print("P2 Was the last person to take a chip so we have to minus his points by %10") time.sleep(3) P2chips -= 5 print("Their updated score is", P2chips) if P1chips > P2chips : print(name1, "wins this round!") p1win += 1 Roundcount += 1 cheat_strike2 = 1 cheat_strike1 = 1 if P1chips < P2chips : print(name2, "wins this round!") p2win += 1 Roundcount += 1 cheat_strike2 = 1 cheat_strike1 = 1 time.sleep(3) ChipNum == 21 if Roundcount > Roundamount : print("The round is over and the results are already in!") time.sleep(3) print("The winner is someone who has tried very hard!") time.sleep(3.5) print("They are also devilously handsome!") time.sleep(3) if p1win < p2win : print("It is", name2,"!") time.sleep(2) print("They won with the lead of", p2win, "Wins!") time.sleep(2) print("Throughout the whole rounds they gained", twotot, "chips overall!") time.sleep(3) print("Thank you for playing please come and play again!") break if p1win > p2win : print("It is", name1,"!") time.sleep(2) print("They won with the lead of", p1win, "Wins!") time.sleep(2) print("Throughout the whole rounds they gained", onetot, "chips overall!") time.sleep(3) print("Thank you for playing please come and play again!") break