import random

# Author:  James Tam
# Version: 2022

MIN_NUM = 1
MAX_NUM = 10
MIN_COLOR = 1
MAX_COLOR = 3
MAX_GUESSES = 10
RED = 1
BLUE = 2
GREEN = 3
gameWon = False

while (gameWon == False):
    stillGuessingNum = True
    guessedNumber = False
    i = 1
    actualNum = random.randrange(MIN_NUM,MAX_NUM)+1
    while (stillGuessingNum == True):
        print("Guess a # from %d-%d: " %(MIN_NUM,MAX_NUM), end="") 
        playerNum = int(input())
        i = i + 1
        if (actualNum == playerNum):
            print("Guessed %d!" %(actualNum))
            stillGuessingNum = False
            guessedNumber = True
        if ((i > MAX_GUESSES) and (guessedNumber == False)):
            stillGuessingNum = False
            print("Exceeded maximum tries of %d" %(MAX_GUESSES))


    stillGuessingColor = True
    guessedColor = False
    i = 1
    numericColor = random.randrange(MIN_COLOR,MAX_COLOR)+1
    while (stillGuessingColor == True):
        actualColor = ""
        if (numericColor == RED):
            actualColor = "red"
        if (numericColor == BLUE):
            actualColor = "blue"
        if (numericColor == GREEN):
            actualColor = "green"
        print(actualColor)
        playerColor = input("Guess color (red, blue, green): ")
        if (playerColor == actualColor):
            print("Guessed actual the color %s" %(actualColor))
            stillGuessingColor = False
            guessedColor = True
        i = i + 1
        if ((i >  MAX_GUESSES) and (guessedColor == False)):
            stillGuessingColor = False
            print("Exceeded maximum tries of %d" %(MAX_GUESSES))

            

    if (guessedNumber == True) and (guessedColor == True):
        gameWon = True


print("You won the game!")
