#-------------------------------------------------
# Project: Take-Away Game
# Standard: 91883 (AS1.7) v.1
# School: Tauranga Boys' College
# Author: Alex
# Date: 10/3/25
# Python: 3.5
#-------------------------------------------------

import random

realnum = random.randint(1,1000)
num = 0
chances = 10
win = 0
lose = 0
rounds = 1
playerscore = 0

print( "Higher or Lower")
print("---------------")
#Asks for name and checks if its valid
while True:
    name = input( "What's ur name? " )
    if name.isalpha() == True:
        print()
        print( "HELLO {} TIME TO GUESS THE NUMBER!!!!".format(name) )
        break
    else:
        print( "THAT IS NOT A VALID NAME!!!!!!!!!!!!!!" )
        print()

#Three rounds
while rounds < 4:
    chances = 10
    realnum = random.randint(1,1000)
    
    while chances > 0:
        num = int(input( "GIVE ME A NUMBER!!: " ) )
        
        #Checks if round is won
        if num == realnum:
            print()
            print( "-------------------" )
            print( "ROUND {} WON!!!!!!".format(rounds) )
            print( "-------------------" )
            print()
            rounds = rounds + 1
            win = win + 1
            playerscore = playerscore + chances + 1000
            print( "{} Score: {}".format(name,playerscore) )
            break
        
        #Checks if the real number is lower
        elif num > realnum:
            chances = chances - 1
            print( "{} is WRONG!!!!!!! ITS LOWERRRRRR!!!".format(name))
            print( "({} chances left)".format(chances) )
            print()

        #Checks if the real number is higher
        elif num < realnum:
            chances = chances - 1
            print( "{} is WRONG!!!!!!! ITS HIGHERRRRRR!!!".format(name))
            print( "({} chances left)".format(chances) )
            print()

        #checks if you run out of guesses
        if chances == 0:
            print()
            print( "-------------------" )
            print( "ROUND {} LOST!!!!!!".format(rounds) )
            print( "-------------------" )
            print()
            rounds = rounds + 1
            lose = lose + 1
            playerscore = playerscore - 500
            print( "{} Score: {}".format(name, playerscore) )

print()     
print( ">>>>>>>>>>>>>>>>>>>" )      
print( "FINAL SCORE" )
print()
print( "Won {}".format(win) )
print( "Lost {}".format(lose) )
print( "...")
print( "YOU GOT {} IMAGINARY POINTS!!!!!!".format(playerscore))
print( "<<<<<<<<<<<<<<<<<<<" )