""" --------------------------------------- Project: Take-Away Game Standard: 91883 (AS1.7) v.1 School: Tauranga Boys College Author: OLLIE CARTWRIGHT Date: "5/03/2025" Python: 3.5 --------------------------------------- """ #imports import random import time #Setting up variables name = " " guesses = 0 rounds = 1 playerscore = 0 computerscore = 0 num = 0 currentround = 1 round_won = False guess = 0 playagain = "y" #Intro print(""" ████████╗░█████╗░██╗░░██╗███████╗  ░█████╗░░██╗░░░░░░░██╗░█████╗░██╗░░░██╗  ░██████╗░░█████╗░███╗░░░███╗███████╗ ╚══██╔══╝██╔══██╗██║░██╔╝██╔════╝  ██╔══██╗░██║░░██╗░░██║██╔══██╗╚██╗░██╔╝  ██╔════╝░██╔══██╗████╗░████║██╔════╝ ░░░██║░░░███████║█████═╝░█████╗░░  ███████║░╚██╗████╗██╔╝███████║░╚████╔╝░  ██║░░██╗░███████║██╔████╔██║█████╗░░ ░░░██║░░░██╔══██║██╔═██╗░██╔══╝░░  ██╔══██║░░████╔═████║░██╔══██║░░╚██╔╝░░  ██║░░╚██╗██╔══██║██║╚██╔╝██║██╔══╝░░ ░░░██║░░░██║░░██║██║░╚██╗███████╗  ██║░░██║░░╚██╔╝░╚██╔╝░██║░░██║░░░██║░░░  ╚██████╔╝██║░░██║██║░╚═╝░██║███████╗ ░░░╚═╝░░░╚═╝░░╚═╝╚═╝░░╚═╝╚══════╝  ╚═╝░░╚═╝░░░╚═╝░░░╚═╝░░╚═╝░░╚═╝░░░╚═╝░░░  ░╚═════╝░╚═╝░░╚═╝╚═╝░░░░░╚═╝╚══════╝ """) name = input("What is your name?: ") print("Hello", name, "welcome to this game.") print("In this game you will try to guess a number between 1 and 1000. If you dont guess the number in 10 rounds or less you lose and the computer gains a point. If you win you gain a point. Whoever has the most amount of points out of 3 rounds wins.") #start of loops while playagain == "y": computerscore = 0 rounds = 1 playerscore = 0 round_won = False while rounds != 4: num = random.randint(1, 1000) guesses = 0 round_won = False print ("Round: ", rounds) print (name + """'s""", "score: ", playerscore) print ("Computer's score: ", computerscore) while guesses < 11 and round_won == False: guess = int(input("Guess: ")) while guess > 1000 or guess < 1: print("Invalid number!") guess = int(input("Guess: ")) if guess == num: round_won = True if guess > num: print("Too high") if guess < num: print("Too low") print(" ") guesses += 1 if round_won == True: playerscore += 1 if round_won == False: computerscore = computerscore + 1 rounds += 1 print ("Your score is:", playerscore) print(" ") print("The computer scored:", computerscore) if computerscore > playerscore: print("The computer won!!") elif playerscore < computerscore: print("You won, nice job!") playagain = input("Do you want to try again? [y]es or [n]o: ")