Exemple #1
0
def main():
    while True:
        clear()
        choice = get_user_choice(main_menu)
        if choice == 1:
            pet_name = input("What would you like to name your pet? ")
            print("Please choose the type of pet:")
            type_choice = get_user_choice(adoption_menu)
            if type_choice == 1:
                pets.append(Pet(pet_name))
            elif type_choice == 2:
                pets.append(CuddlyPet(pet_name))
            print("You now have %d pets" % len(pets))
        if choice == 2:
            for pet in pets:
                pet.get_love()
        if choice == 3:
            for pet in pets:
                pet.eat_food()
        if choice == 4:
            for pet in pets:
                pet.get_toy(Toy())
        if choice == 5:
            for pet in pets:
                print(pet)
                input("")
        if choice == 6:
            for pet in pets:
                pet.be_alive()
        if choice == 7:
            clear()
            print("Thanks for adopting and taking care of your pet.")
            return False
Exemple #2
0
def main():
    while True:
        choice = get_user_choice(main_menu)
        if choice == 1:
            pet_name = input("What would you like to name your pet?\n")
            print("Please choose the type of pet:")
            type_choice = get_user_choice(adoption_menu)
            if type_choice == 1:
                pets.append(Pet(pet_name))
            elif type_choice == 2:
                pets.append(CuddlyPet(pet_name))
            pets.append(Pet(pet_name))
            print("You now hae %s pets" % len(pets))
        if choice == 2:
            for pet in pets:
                pet.get_love()
        if choice == 3:
            for pet in pets:
                pet.eat_food()
        if choice == 4:
            for pet in pets:
                print(pet)
        if choice == 5:
            for pet in pets:
                pet.get_toy(Toy())
        if choice == 6:
            for pet in pets:
                pet.be_alive()

        if choice == 7:
            print("Thanks for playing!!!")
            break
Exemple #3
0
def main():
    while True:
        choice = get_user_choice(main_menu)
        #allowing user to adopt a pet
        if choice == 1:
            pet_name = input("What would you like to name your pet? ")
            print("Please choose the type of pet:")
            type_choice = get_user_choice(adoption_menu)
            if type_choice == 1:
                pets.append(Pet(pet_name))
            elif type_choice == 2:
                pets.append(CuddlyPet(pet_name))
            print("You now have %d pets" % len(pets))
        if choice == 2:
            for pet in pets:
                pet.get_love()
        if choice == 3:
            for pet in pets:
                pet.eat_food()
        #View pet status
        if choice == 4:
            for pet in pets:
                print(pet)
        if choice == 5:
            for pet in pets:
                pet.get_toy(Toy())
        if choice == 6:
            # Pet levels naturally lower.
            for pet in pets:
                pet.be_alive()
Exemple #4
0
def main():
    print("\033c")
    while True:
        choice = get_user_choice(main_menu)

        if choice == 1:
            pet_name = input("What would you like to name your pet? ")
            print("Please choose the type of pet: ")
            type_choice = get_user_choice(adoption_menu)
            if type_choice == 1:
                pets.append(Pet(pet_name))
            elif type_choice == 2:
                pets.append(CuddlyPet(pet_name))
            print("You now have %d pets" % len(pets))
            transition()

        if choice == 2:
            for pet in pets:
                pet.get_love()
                print("All your pets are now a little happier!\n")
            transition()

        if choice == 3:
            for pet in pets:
                pet.eat_food()
                print("All your pets are now a little more full!\n")
            transition()

        if choice == 4:
            if pets != []:
                for pet in pets:
                    print(pet)
            else:
                print("You don't have any pets right now.\n")
            transition()

        if choice == 5:
            for pet in pets:
                pet.get_toy(Toy())
                print("You gave all your pets a toy!\n")
            transition()

        if choice == 6:
            for pet in pets:
                pet.be_alive()
            transition()
def main():  #copied and pasted
    while True:
        choice = get_user_choice(main_menu)
        if choice == 1:
            pet_name = input("What would you like to name your pet? ")
            print("Please choose the type of pet:")
            type_choice = get_user_choice(adoption_menu)
            if type_choice == 1:
                pets.append(
                    Pet(pet_name)
                )  #still not sure why error ***had incorrect vlaues for methods FIXED
            elif type_choice == 2:
                pets.append(CuddlyPet(pet_name))
            print("You now have %d pets" % len(pets))

        if choice == 4:
            for pet in pets:
                print(pet)
Exemple #6
0
def main():
    main = Menu("Please choose an option:", main_menu)
    type = Menu("Please choose the type of pet:", adoption_menu)
    treat = Menu("Please choose the type of treat:", treat_menu)
    while True:
        choice = main.get_choice()
        if choice == 1:
            pet_name = input("What would you like to name your pet? ")
            type_choice = type.get_user_choice()
            if type_choice == 1:
                pets.append(Pet(pet_name))
            elif type_choice == 2:
                pets.append(CuddlyPet(pet_name))
            print("You now have %d pets" % len(pets))
        if choice == 2:
            for pet in pets:
                pet.get_love()
            print("Pets have been loved!")
        if choice == 3:
            for pet in pets:
                pet.eat_food()
            print("Pets have been fed!")
        if choice == 4:
            for pet in pets:
                print(pet)
        if choice == 5:
            for pet in pets:
                pet.get_toy(Toy())
            print("Pets got a toy!")
        if choice == 6:
            treat_choice = treat.get_user_choice()
            if treat_choice == 1:
                treat_type = ColdPizza()
            if treat_choice == 2:
                treat_type = Bacon()
            if treat_choice == 3:
                treat_type = VeganSnack
            for pet in pets:
                pet.get_treat(treat_type)
            print("Pets got a treat!")
        if choice == 7:
            for pet in pets:
                pet.be_alive()
            print("Pets did nothing!")
Exemple #7
0
def main():
    app = Menu("Please choose an option", main_menu)
    types = Menu("Please choose a type of pet", adoption_menu)
    treats = Menu("please choose a type of treat", treat_menu)
    while True:
        choice = app.get_user_choice()
        if choice == 1:
            pet_name = input("What would you like the pet name to be?")
            type_choice = types.get_user_choice()
            if type_choice == 1:
                pets.append(Pet(pet_name))
            elif type_choice == 2:
                pets.append(CuddlyPet(pet_name))
            num_pets = len(pets)
            print(f"You now have {num_pets} pets")
        elif choice == 2:
            for pet in pets:
                pet.get_love()
        elif choice == 3:
            for pet in pets:
                pet.eat_food()
        elif choice == 4:
            for pet in pets:
                print(pet)
        elif choice == 5:
            for pet in pets:
                pet.get_toy(Toy())
        elif choice == 6:
            for pet in pets:
                pet.be_alive()
        elif choice == 7:
            print("Please choose your type of treat:")
            treat_choice = treats.get_user_choice
            if treat_choice == 1:
                for pet in pets:
                    pet.eat_treat(ColdPizza())
            elif treat_choice == 2:
                for pet in pets:
                    pet.eat_treat(Bacon())
            elif treat_choice == 3:
                for pet in pets:
                    pet.eat_treat(VeganSnack())
Exemple #8
0
def main():
    app = Menu('Please choose an Option: ', main_menu)
    types = Menu('Please choose a Pet Option: ', adoption_menu)
    treats = Menu('Please choose a Treat Option: ', menu_menu)
    while True:
        choice = app.get_choice()
        if choice == 1:
            pet_name = input('What do you want to name your pet?')
            type_choice = types.get_choice()
            if (type_choice == 1):
                pets.append(Pet(pet_name))
            elif (type_choice == 2):
                pets.append(CuddlyPet(pet_name))
            print(f'\n\nYou now have {len(pets)} pets')
        elif choice == 2:
            for pet in pets: pet.get_love()
        elif choice == 3:
            treat_choice = treats.get_choice()
            food_to_feed = 0
            if(treat_choice == 1):
                food_to_feed = ColdPizza()
            elif(treat_choice == 2):
                food_to_feed = Bacon()
            elif(treat_choice == 3):
                food_to_feed = VeganSnack()
            for pet in pets: pet.eat_food(food_to_feed)
        elif choice == 4:
            for pet in pets:
                print(pet)
        elif choice == 5:
            for pet in pets:
                pet.get_toy(Toy())
        elif choice == 6:
            for pet in pets: 
                pet.be_alive()
                print(pet)
Exemple #9
0
def main():
    while True:
        choice = get_user_choice(main_menu)
        if choice == 1:
            pet_name = input("What would you like to name your pet? ")
            print("Please choose the type of pet:")
            type_choice = get_user_choice(adoption_menu)
            if type_choice == 1:
                pets.append(Pet(pet_name))
                print(
                    "Good choice, these pets are great to start your journey as pet owner.\n"
                )
            elif type_choice == 2:
                pets.append(CuddlyPet(pet_name))
                print(
                    "Great choice, these pets are great for one's mental health and great anxiety reducers. But they do require lots of attention.\n"
                )
            print("You now have %d pets.\n" % len(pets))


### first part of the main menu
#### when a choice is made it starts the loop of choices

        elif choice == 2:
            for pet in pets:
                pet.get_love()
                if pet.happiness >= 8 and pet.happiness < 10:
                    print(
                        f"{pet_name}, is very happy, may want rest a bit. \n")
                elif pet.happiness >= 10:
                    print(f"{pet_name} is very tired and needs to rest. \n")

        elif choice == 3:
            for pet in pets:
                pet.eat_food()
                if pet.fullness >= 8 and pet.fullness < 10:
                    print(
                        f"{pet_name}, is statisfied, you can stop feeding it. \n"
                    )
                elif pet.fullness >= 10:
                    print(
                        f"{pet_name} has over eatten, and now needs to sleep. \n"
                    )

        elif choice == 4:
            for pet in pets:
                print(pet)

        elif choice == 5:
            for pet in pets:
                pet.get_toy(Toy())

        elif choice == 6:
            # Pet levels naturally lower.
            for pet in pets:
                pet.be_alive()
                if pet.happiness <= 3 and pet.happiness > 0:
                    print(
                        f"{pet_name} is sad, you may want to play with your pet.\n"
                    )
                elif pet.fullness <= 3 and pet.fullness > 0:
                    print(
                        f"{pet_name} is hungry, you may want to feed your pet.\n"
                    )
                elif pet.fullness <= 0:
                    print(
                        f"{pet_name}, has died of hunger. Expect a call from the authorities!!!\n"
                    )
                    break
                elif pet.happiness <= 0:
                    print(
                        f"{pet_name}, has run away, you may want to reflect of your life choices!\n"
                    )
                    break
            ### when this choice is made, depending on the level pet is already, parameter is set to notify the user of pets health and happiness.

        elif choice == 7:
            print("Thanks for playing, tell your friends! \n")
            break