# Challenge 3
# By: Brianna Nicole Melius y Zachary Michael Joseph Anthony Golik
# Date: 02/10/15

class Critter(object):
    """A virtual pet"""
    def __init__(self, name, hunger = 0, boredom = 0):
        self.name = name
        self.hunger = hunger
        self.boredom = boredom

    def __pass_time(self):
        self.hunger += 1
        self.boredom += 1

    @property
    def mood(self):
        unhappiness = self.hunger + self.boredom
        if unhappiness < 5:
            m = "happy"
        elif 5 <= unhappiness <= 10:
            m = "okay"
        elif 11 <= unhappiness <= 15:
            m = "frustrated"
        else:
            m = "mad"
        return m
    
    def talk(self):
        print("I'm", self.name, "and I feel", self.mood, "now.\n")
        self.__pass_time()
    
    def eat(self, food):
        print("Brruppp.  Thank you.")
        self.hunger -= food
        if self.hunger < 0:
            self.hunger = 0
        self.__pass_time()

    def play(self, fun):
        print("Wheee!")
        self.boredom -= fun
        if self.boredom < 0:
            self.boredom = 0
        self.__pass_time()

    def secret(self):
        print("Name:", self.name)
        print("Hunger:", self.hunger)
        print("Boredom:", self.boredom)
        print("Mood:", self.mood.capitalize())
        self.__pass_time()


def main():
    crit_name = input("What do you want to name your critter?: ")
    crit = Critter(crit_name)

    choice = None  
    while choice != "0":
        print \
        ("""
        Critter Caretaker
    
        0 - Quit
        1 - Listen to your critter
        2 - Feed your critter
        3 - Play with your critter
        """)
    
        choice = input("Choice: ")
        print()

        # exit
        if choice == "0":
            print("Good-bye.")

        # listen to your critter
        elif choice == "1":
            crit.talk()
        
        # feed your critter
        elif choice == "2":
            food = int(input("How much food do you want to feed your critter? "))
            while food not in range(1, 11):
                print("A number between 1 and 10!!!")
                food = int(input("How much food do you want to feed your critter? "))
            crit.eat(food)
         
        # play with your critter
        elif choice == "3":
            fun = int(input("How long would you like to play with your pet? "))
            while fun not in range(1, 11):
                print("A number between 1 and 10!!!")
                fun = int(input("How long would you like to play with your pet? "))
            crit.play(fun)

        # secret function
        elif choice == "62578":
            crit.secret()

        # some unknown choice
        else:
            print("\nSorry, but", choice, "isn't a valid choice.")

main()
("\n\nPress the enter key to exit.") 
