#------------------------------------------------- # Project: Guess The Number # Standard: 91883 (AS1.7) v.1 # School: Tauranga Boys' College # Author: Rover Paramio # Date: THE DATE YOU COMPLETED THE CODE # Python: 3.5 #------------------------------------------------- import random import time # Starting Variables # Main variables num_Rounds = 3 player_Score = 0 ai_Score = 0 round_Finished = True rounds = 3 rum_guesses = 0 GUESS = 10 number = 0 #player desicion preset player_desicion = " " # Game name = input("What is your name?: ") print ("Hello", name, "and welcome to.......") #time.sleep(2) print (" _____ _____ _ _ _ _ ") print ("| __ \ |_ _|| | | \ | | | | ") print ("| | \/ _ _ ___ ___ ___ | | | |__ ___ | \| | _ _ _ __ ___ | |__ ___ _ __") print ("| | __ | | | | / _ \/ __|/ __| | | | '_ \ / _ \ | . ` || | | || '_ ` _ \ | '_ \ / _ \| '__| ") print ("| |_\ \| |_| || __/\__ \\__ \ | | | | | || __/ | |\ || |_| || | | | | || |_) || __/| | ") print (" \____/ \__,_| \___||___/|___/ \_/ |_| |_| \___| \_| \_/ \__,_||_| |_| |_||_.__/ \___||_| ") #time.sleep(1) #Game rules print("The Rules of the GUESS THE NUMBER is that you have to guess the number that AI has given you.") #time.sleep(1) print("This game is of the best of 3 and you have to guess a number between 1 and 1000, and you have 10 guesses per round") #time.sleep(1) print("Do your best to beat the Ai and don't lose ") #time.sleep(0.5) print(" Now its time to play GUESS THE NUMBER") while rounds > 1 : number = random.randint(1,100) Num_guesses = GUESS while Num_guesses > 0: player_desicion = int(input(" what is the number: ")) print() #If Question is correct if number == player_desicion : print (" correct!") rounds -= 1 player_Score += 1 print(" You have {} Rounds won".format(player_Score)) print("The AI has {} Round won".format(ai_Score)) break #If Question is wrong #Higher elif player_desicion < number : print("incorrect higher") Num_guesses -= 1 #lower else: print("Incorrect Lower") Num_guesses -= 1 if Num_guesses == 0: print("the AI won this round") round -= 1 ai_Score += 1 print("You have {} rounds won".format(player_Score)) print("The AI has {} rounds won".format(ai_Score)) break #End of the game code if player_Score < ai_Score: print ("The AI has won") print("your score was{}".format(player_Score)) print("The AI score was {}".format(ai_Score)) print(" btter luck next time") else: print("You won!") print("your score was {}".format(player_Score)) print("The AI score was {}".format(ai_Score)) print("Good job {} see you next time".format(name))