""" ------------------------------------------------- Project: Take-Away Game Standard: 91883 (AS1.7) v.1 School: Tauranga Boys' College Author: Prabvir Shoker Date: THE DATE YOU COMPLETED THE CODE Python: 3.5 ------------------------------------------------- """ import time import random start_player_score = 0 start_BOT_score = 0 start_guesses = 10 round=0 player_number=0 BOT_number=0 player_score=start_player_score BOT_score=start_BOT_score play_again="y" while True: name = input("What is your name? ") if name.isalpha() == True: print("Hello " + name ) time.sleep(1) break else: print("Choose a name with letters.") print("We can now start the game.. i'm thinking of a number between 1 - 1000") time.sleep(3) print ("Start guessing the number im thinking of, 1 between 1000 and a reminder you only have 10 guesses, good luck!") time.sleep(3) while play_again == "y": player_score=start_player_score BOT_score = start_BOT_score BOT_number = random.randint(1,1000) gusses=start_guesses while player_number != BOT_number : player_number = int(input("what do you think the number is? ")) time.sleep(1) #this is to check if the player has guessed the number and give you a point if player_number == BOT_number: print("") print("You got it!") time.sleep(2) player_score = player_score + 1 BOT_score = BOT_score + 0 round = round + 1 print("CPU_score is {}".format(BOT_score)) print("") print("player score is {}".format(player_score)) BOT_number= random.randint(1,1000) guesses =start_guesses #this is to check if the number is higher than the actual number and tell him it is lower elif player_number > BOT_number: player_number = start_player_score print("lower! ") print("") guesses = guesses - 1 print("you have {} guesses left".format(guesses)) if guesses ==0: print("you lost the number is {}".format(BOT_number)) BOT_score = BOT_score + 1 player_score = player_score + 0 print("CPU_score is {}".format(BOT_score)) print("") print("player score is {}".format(player_score)) BOT_number= random.randint(1,1000) guesses =start_guesses player_number = start_player_score else: print("higher! ") print("") guesses = guesses - 1 print("you have {} guesses left".format(guesses)) if guesses ==0: print("you lost the number is {}".format(BOT_number)) BOT_score = BOT_score + 1 player_score = player_score + 0 print("CPU_score is {}".format(BOT_score)) print("") print("player score is {}".format(player_score)) BOT_number= random.randint(1,1000) guesses =start_guesses player_number == start_player_score if player_score == 2: print ("you have won! you are the best player in the world") time.sleep(2) print("") print("") print("the score was {} {} to CPU {}".format(name,player_score,BOT_score)) play_again=input("would you like to play again? [y]es or [n]o? ") if play_again != "y": break else: player_score = start_player_score BOT_score = start_BOT_score BOT_number = random.randint(1,10) guesses = start_guesses elif CPU_score == 2: print ("you have lost to the all powerful AI! you suck") print("") print("the score was CPU {} to {} {}".format(BOT_score,name,player_score)) time.sleep(2) print("") play_again=input("would you like to play again? [y]es or [n]o? ") if play_again != "y": break else: player_score = start_player_score BOT_number_score = start_BOT_score BOT_number = random.randint(1,10) guesses = start_guesses print("") print("thank you for playing my game")