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):
    #Guessing number
    stillGuessingNum= True
    guessedNumber = False
    actualNum = -1
    playNum = -1
    i = 1
    actualNum = random.randrange(MIN_NUM,MAX_NUM)+1
    while (stillGuessingNum == True):

        print(actualNum)
    
        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
        elif (i > MAX_GUESSES):
            stillGuessingNum = False
            guessedNumber = False
            print("Exceeded maximum tries of %d" %(MAX_GUESSES))

    #Guessing color
    stillGuessingColor= True
    guessedColor = False
    numericColor = -1
    actualColor = ""
    playColor = ""
    i = 1
    numericColor = random.randrange(MIN_COLOR,MAX_COLOR)+1
    while (stillGuessingColor == True):
        if (numericColor == RED):
            actualColor = "red"
        if (numericColor == BLUE):
            actualColor = "blue"
        if (numericColor == GREEN):
            actualColor = "green"

        print(actualColor)
        
        playerColor = input("Guess color (red, blue, green): ")
        i = i + 1
        if (playerColor == actualColor):
            print("Guessed actual the color %s" %(actualColor))
            stillGuessingColor = False
            guessedColor = True
        elif (i >  MAX_GUESSES):
            stillGuessingColor = False
            print("Exceeded maximum tries of %d" %(MAX_GUESSES))
    input("Press enter to continue")
    if (guessedNumber == True) and (guessedColor == True):
        gameWon = True
        
print("You won the game!")


