def feed_pueo():
    os.system('cls' if os.name == 'nt' else 'clear')

    pueo = Pueo()
    pueo_prey = pueo.prey
    feeding_time = sorted(list(pueo_prey))

    for index, food in enumerate(feeding_time):
        print(f"{index + 1}. {food}")

    choice = input("\nWhat is on the menu for the Pueo today?\n >_ ")

    if choice == "1":
        pueo.feed(feeding_time[int(choice) - 1])

    if choice == "2":
        pueo.feed(feeding_time[int(choice) - 1])

    if choice == "3":
        pueo.feed(feeding_time[int(choice) - 1])

    if choice == "4":
        pueo.feed(feeding_time[int(choice) - 1])

    choice = input("\nPress any key to go back.\n >_")
Ejemplo n.º 2
0
def release_animal(arboretum):
    animal = None

    print("1. River Dolphin")
    print("2. Ope'ape'a")
    print("3. Pueo")
    print("4. Ulae")
    print("5. Gold Dust Day Gecko")
    print("6. Nene Goose")
    print("7. Kikakapu")
    print("8. Hawaiian Happy-Face Spider")

    choice = input("Choose animal to release > ")

    if choice == "1":
        animal = RiverDolphin()
    elif choice == "2":
        animal = OpeApeA()
    elif choice == "3":
        animal = Pueo()
    elif choice == "4":
        animal = Ulae()
    elif choice == "5":
        animal = Gecko()
    elif choice == "6":
        animal = NeneGoose()
    elif choice == "7":
        animal = Kikakapu()
    elif choice == "8":
        animal = HappySpider()
    else:
        animal = None
        print("Not a valid choice")
        release_animal(arboretum)
        return

    avail = []
    for biome in arboretum.biomes:
        if biome.check_suitability(animal):
            if biome.animal_count < biome.max_animals:
                avail.append(biome)
                print(
                    f"{len(avail)}. {biome.biome_type.capitalize()}: {biome.name} ({biome.animal_count} animals)"
                )

    option = input("Select biome > ")
    try:
        avail[int(option) - 1].add_animal(animal)
    except OverflowError:
        print(
            f"{avail[int(option) -1].name} already has the maximum number of animals."
        )
        release_animal(arboretum)
        return
    except IndexError:
        print("Not a valid option.")
        release_animal(arboretum)
        return
    else:
        print(f"Added {animal.species} to {avail[int(option) - 1].name}!")
def release_animal(arboretum):
    animal = None

    print("\nplease enter the animal you want to release\n")
    print("1. River Dolphin")
    print("2. Opeapea")
    print("3. Peuo")
    print("4. Gold Dust Day Gecko")
    print("5. Ulae")
    print("6. Nene Goose")
    print("7. Kikakapu")
    print("8. Hawaiian Happy Face Spider")
    print("9. back")

    choice1 = input("Choose animal to release > ")

    if choice1 == "1":
        animal = RiverDolphin()
        release_into_enviroment(animal, arboretum)

    elif choice1 == "2":
        animal = Opeapea()
        release_into_enviroment(animal, arboretum)

    elif choice1 == "3":
        animal = Pueo()
        release_into_enviroment(animal, arboretum)

    elif choice1 == "4":
        animal = Gecko()
        release_into_enviroment(animal, arboretum)

    elif choice1 == "5":
        animal = Ulae()
        release_into_enviroment(animal, arboretum)

    elif choice1 == "6":
        animal = Goose()
        release_into_enviroment(animal, arboretum)

    elif choice1 == "7":
        animal = Kikakapu()
        release_into_enviroment(animal, arboretum)

    elif choice1 == "8":
        animal = Spider()
        release_into_enviroment(animal, arboretum)

    elif choice1 == "9":
        pass

    else:
        print("\nplease enter number listed\n\n")
        release_animal(arboretum)
def release_animal(arboretum):
    animal = None

    print("1. Gold Dust Day Gecko")
    print("2. River Dolphin")
    print("3. Nene Goose")
    print("4. Kikakapu")
    print("5. Pueo")
    print("6. 'Ulae")
    print("7. Ope'ape'a")
    print("8. Hawaiian Happy-Face Spider")

    choice = input("Choose animal to release > ")

    if choice == "1":
        animal = Gecko()

    if choice == "2":
        animal = RiverDolphin()

    if choice == "3":
        animal = Goose()

    if choice == "4":
        animal = Kikakapu()

    if choice == "5":
        animal = Pueo()

    if choice == "6":
        animal = Ulae()

    if choice == "7":
        animal = Opeapea()

    if choice == "8":
        animal = Spider()

# create animal instance
#iterate over every habitat list in keahua
# put habitats in mega list called all_habitats
# also have a set called all_habitats_set that you can loop through to figure out type of habitat animal can go into

    print(arboretum.rivers)
    for index, river in enumerate(arboretum.rivers):
        print(f'{index + 1}. River {river.id}')

    print("Release the animal into which biome?")
    choice = input("> ")
    # check to see which biomes animal can be added to
    # display appropriate biomes

    arboretum.rivers[int(choice) - 1].animals.append(animal)
    def feed_animal(self, choice):
        os.system('cls' if os.name == 'nt' else 'clear')
        if choice == "1":
            animal_to_feed = GoldDustDayGecko()

        elif choice == "2":
            animal_to_feed = RiverDolphin()

        elif choice == "3":
            animal_to_feed = NeneGoose()

        elif choice == "4":
            animal_to_feed = Kikakapu()

        elif choice == "5":
            animal_to_feed = Pueo()

        elif choice == "6":
            animal_to_feed = Ulae()

        elif choice == "7":
            animal_to_feed = Opeapea()

        elif choice == "8":
            animal_to_feed = HappyFaceSpider()

        else:
            print("No no. Feed something else.")
            return

        for i, v in enumerate(animal_to_feed.prey):
            print(f'{i + 1}. {v}')

        print("Which prey do you want to feed the animal?")
        choice = input("> ")

        targetPrey = animal_to_feed.prey[int(choice) - 1]
        animal_to_feed.feed(targetPrey)
Ejemplo n.º 6
0
def release_animal(arboretum):
    animal = None

    os.system('cls' if os.name == 'nt' else 'clear')

    print("1. Gold Dust Day Gecko")
    print("2. River Dolphin")
    print("3. Nene Goose")
    print("4. Kīkākapu")
    print("5. Pueo")
    print("6. 'Ulae")
    print("7. Ope'ape'a")
    print("8. Happy-Face Spider")

    choice = input("\nChoose animal. \n>_ ")

    if choice == "1":
        animal = Gecko()

        for index, forest in enumerate(arboretum.forests):
            print(f"\n {index + 1}. {forest} ({len(forest.animals)} animals)")

        biome_choice = input(
            f"\nChoose which biome to release the {animal.species}.\n>_ ")

        if biome_choice == "1" and len(arboretum.forests[0].animals) < 20:

            arboretum.forests[0].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "2" and len(arboretum.forests[1].animals) < 20:

            arboretum.forests[1].add_animal(animal)

            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "3" and len(arboretum.forests[2].animals) < 20:

            arboretum.forests[2].add_animal(animal)

            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "4" and len(arboretum.forests[3].animals) < 20:

            arboretum.forests[3].add_animal(animal)

            input("\nPress any key to return to the main menu \n>_")

    if choice == "2":
        animal = RiverDolphin()

        for index, river in enumerate(arboretum.rivers):
            print(f"{index + 1}. {river} ({len(river.animals)} animals)")

        biome_choice = input(
            f"\nChoose which biome to release the {animal.species}.\n>_ ")

        if biome_choice == "1" and len(arboretum.rivers[0].animals) < 12:

            arboretum.rivers[0].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "2" and len(arboretum.rivers[1].animals) < 12:

            arboretum.rivers[1].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "3" and len(arboretum.rivers[2].animals) < 12:

            arboretum.rivers[2].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "4" and len(arboretum.rivers[3].animals) < 12:

            arboretum.rivers[3].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")
    if choice == "3":
        animal = Nene_Goose()

        for index, grassland in enumerate(arboretum.grasslands):
            print(
                f"\n {index + 1}. {grassland} ({len(grassland.animals)} animals)"
            )

        biome_choice = input(
            f"\nChoose which biome to release the {animal.species}.\n>_ ")

        if biome_choice == "1" and len(arboretum.grasslands[0].animals) < 20:
            arboretum.grasslands[0].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

    if choice == "4":
        animal = Kikakapu()

        for index, swamp in enumerate(arboretum.swamps):
            print(f"\n {index + 1}. {swamp} ({len(swamp.animals)} animals)")

        biome_choice = input(
            f"\nChoose which biome to release the {animal.species}.\n>_ ")

        if biome_choice == "1" and len(arboretum.swamps[0].animals) < 20:
            arboretum.swamps[0].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

    if choice == "5":
        animal = Pueo()

        for index, forest in enumerate(arboretum.forests):
            print(f"\n {index + 1}. {forest} ({len(forest.animals)} animals)")

        biome_choice = input(
            f"\nChoose which biome to release the {animal.species}.\n>_ ")

        if biome_choice == "1" and len(arboretum.forests[0].animals) < 20:
            arboretum.forests[0].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

    if choice == "6":
        animal = Ulae()
        for index, coastline in enumerate(arboretum.coastlines):
            print(
                f"\n {index + 1}. {coastline} ({len(coastline.animals)} animals)"
            )

        biome_choice = input(
            f"\nChoose which biome to release the {animal.species}.\n>_ ")

        if biome_choice == "1" and len(arboretum.coastlines[0].animals) < 16:
            arboretum.coastlines[0].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

    if choice == "7":
        animal = Opeapea()
        # mountain = Mountain()
        # forest = Forest()
        for index, mountain in enumerate(arboretum.mountains):
            print(
                f"\n {index + 1}. {mountain} ({len(mountain.animals)} animals)"
            )

        biome_choice = input(
            f"\nChoose which biome to release the {animal.species}.\n>_ ")

        if biome_choice == "1" and len(arboretum.mountains[0].animals) < 6:

            arboretum.mountains[0].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "2" and len(arboretum.mountains[1].animals) < 6:

            arboretum.mountains[1].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "3" and len(arboretum.mountains[2].animals) < 6:

            arboretum.mountains[2].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "4" and len(arboretum.mountains[3].animals) < 6:

            arboretum.mountains[3].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "5" and len(arboretum.mountains[4].animals) < 6:

            arboretum.mountains[4].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

    if choice == "8":
        animal = HappyFaceSpider()
        # swamp = Swamp()
        for index, swamp in enumerate(arboretum.swamps):
            print(f"\n {index + 1}. {swamp} ({len(swamp.animals)} animals)")

        biome_choice = input(
            f"\nChoose which biome to release the {animal.species}.\n>_ ")

        if biome_choice == "1" and len(arboretum.swamps[0].animals) < 8:

            arboretum.swamps[0].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "2" and len(arboretum.swamps[1].animals) < 8:

            arboretum.swamps[1].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "3" and len(arboretum.swamps[2].animals) < 8:

            arboretum.swamps[2].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "4" and len(arboretum.swamps[3].animals) < 8:

            arboretum.swamps[3].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")

        if biome_choice == "5" and len(arboretum.swamps[4].animals) < 8:

            arboretum.swamps[4].add_animal(animal)
            input("\nPress any key to return to the main menu \n>_")
Ejemplo n.º 7
0
def release_animal(arboretum, wrong_choice):
    """
        Prompts user to create an Animal to release into an Enviornment.
    """

    animal = None

    if wrong_choice != True:
        print_header()

    print()
    print(f'{add_color("1.", "bright_cyan")} Gold Dust Day Gecko')
    print(f'{add_color("2.", "bright_cyan")} Hawaiian Happy-Face Spider')
    print(f'{add_color("3.", "bright_cyan")} Kīkākapu')
    print(f'{add_color("4.", "bright_cyan")} Nene Goose')
    print(f'{add_color("5.", "bright_cyan")} Ope\'ape\'a')
    print(f'{add_color("6.", "bright_cyan")} Pueo')
    print(f'{add_color("7.", "bright_cyan")} River Dolphin')
    print(f'{add_color("8.", "bright_cyan")} \'Ulae')
    print()

    print(
        f'{add_color("Select an animal to release", "WARNING")}{CLColors.ENDC}'
    )
    choice = input("> ")

    if choice == "1":
        animal = GoldDustDayGecko()

    elif choice == "2":
        animal = HawaiianHappyFaceSpider()

    elif choice == "3":
        animal = Kikakapu()

    elif choice == "4":
        animal = NeneGoose()

    elif choice == "5":
        animal = OpeApeA()

    elif choice == "6":
        animal = Pueo()

    elif choice == "7":
        animal = RiverDolphin()

    elif choice == "8":
        animal = RiverDolphin()

    else:
        wrong_choice = True
        clear()
        print(
            f'{add_color(f"{choice} is not an animal. Please make another selection.", "FAIL")}'
        )
        print()
        release_animal(arboretum, wrong_choice)

    print(f'Getting the {animal.species} ready...')
    loading_sequence()
    time.sleep(1.5)
    clear()

    print(f'{add_color("Available Biomes:", "HEADER")}')
    print()

    biome_list = list()
    for index, coastline in enumerate(arboretum.coastlines):
        biome_list.append(coastline)

    for index, forest in enumerate(arboretum.forests):
        biome_list.append(forest)

    for index, grassland in enumerate(arboretum.grasslands):
        biome_list.append(grassland)

    for index, mountain in enumerate(arboretum.mountains):
        biome_list.append(mountains)

    for index, river in enumerate(arboretum.rivers):
        biome_list.append(river)

    for index, swamp in enumerate(arboretum.swamps):
        biome_list.append(swamp)

    for index, biome in enumerate(biome_list):
        print(
            f'{add_color(f"{index + 1}.", "bright_cyan")} {biome.name} {type(biome).__name__} [{str(biome.id)[:8]}]: ({len(biome.animals)} animals)'
        )

    print()
    print()
    print(
        f'{add_color(f"Release the {animal.species} into which biome?", "WARNING")}'
    )
    choice = input("> ")

    # check if choice selected exists as an index on the biome_list
    if (int(choice) - 1) < len(biome_list):
        biome = biome_list[int(choice) - 1]
        biome.add_animal(animal)

    print()
    print(
        f'Releasing the {animal.species} into the {biome.name} {type(biome).__name__}...'
    )
    loading_sequence()
    time.sleep(1.5)
Ejemplo n.º 8
0
def release_animal(arboretum):
    animal = None
    print_banner()
    print("ANIMAL RELEASE OPTIONS:")
    print("")
    print("1. Gold Dust Day Gecko")
    print("2. River Dolphin")
    print("3. Nene Goose")
    print("4. Kīkākapu")
    print("5. Pueo")
    print("6. 'Ulae")
    print("7. Ope'ape'a")
    print("8. Happy-Face Spider")
    print("")
    choice = input("Choose an animal to release >> ")

    if choice == "1":
        animal = GoldDustDayGecko()

    if choice == "2":
        animal = RiverDolphin()

    if choice == "3":
        animal = NeneGoose()

    if choice == "4":
        animal = Kikakapu()

    if choice == "5":
        animal = Pueo()

    if choice == "6":
        animal = Ulae()

    if choice == "7":
        animal = Opeapea()

    if choice == "8":
        animal = HawaiianHappyFaceSpider()

    # Get all biome lists
    biomes = [
        arboretum.rivers, arboretum.coastlines, arboretum.swamps,
        arboretum.grasslands, arboretum.mountains, arboretum.forests
    ]

    # Create empty options list of available biome environments
    options = []

    # iterate biome lists and add available environments to options list
    for biome in biomes:
        for environment in biome:
            if len(environment.animals) < environment.animal_max:
                options.append(environment)

    # iterate options list to create menu options
    for index, option in enumerate(options):
        print(f'{index + 1}. {option} ({len(option.animals)} animals)')

    # Handle if user has no options
    if len(options) > 0:
        # prompt user to place animal
        print("Release the animal into which biome?")
        choice = input("> ")
        # TODO check input is a valid option
        if int(choice) > 0 and int(choice) <= len(options) + 1:
            # place animal in selected biome list
            animal.age = animal.release_age
            options[int(choice) - 1].add_animal(animal)
        else:
            print("Invalid Entry")
            input("\n\nPress enter to continue...")
    else:
        print("No biomes available for this animal.")
        print("Select a different animal or annex a new biome.")
        input("\n\nPress enter to continue...")
Ejemplo n.º 9
0
def release_animal(arboretum):
    compatible_biomes = []
    animal = None

    print("1. River Dolphin")
    print("2. Pueo (Owl)")
    print("3. Ulae (Lizard Fish)")
    print("4. Gold Gecko")
    print("5. Nene Goose")
    print("6. Kikakapu (Fish)")
    print("7. Opeapea (Bat)")
    print("8. Happy Spider")

    choice = input("\nChoose animal to release > ")

    if choice == "1":
        animal = RiverDolphin()

    elif choice == "2":
        animal = Pueo()

    elif choice == "3":
        animal = Ulae()

    elif choice == "4":
        animal = GoldGecko()

    elif choice == "5":
        animal = NeneGoose()

    elif choice == "6":
        animal = Kikakapu()

    elif choice == "7":
        animal = Opeapea()

    elif choice == "8":
        animal = HappySpider()

    else:
        input(
            "\nThat was a bad input, try again next time, fool! \nPress any key to return to the menu..."
        )
        return

    if isinstance(animal, Freshwater):
        for eachitem in arboretum.rivers:
            compatible_biomes.append(eachitem)

    if isinstance(animal, Stagnant):
        for eachitem in arboretum.swamps:
            compatible_biomes.append(eachitem)

    if isinstance(animal, Saltwater):
        for eachitem in arboretum.coastlines:
            compatible_biomes.append(eachitem)

    if isinstance(animal, Forestful):
        for eachitem in arboretum.forests:
            compatible_biomes.append(eachitem)

    if isinstance(animal, Mountainful):
        for eachitem in arboretum.mountains:
            compatible_biomes.append(eachitem)

    if isinstance(animal, Grassful):
        for eachitem in arboretum.grasslands:
            compatible_biomes.append(eachitem)

    for index, biome in enumerate(compatible_biomes):
        print(f'{index + 1}. {biome.name} ({len(biome.animals)} animals)')

    def add_animal(choice):
        if choice == "":
            input("Press any key to return to the menu...")
            return
        try:
            # If statement checks for number within lenght of biome list and if adding organism will exceed biome capacity
            if choice != "" and int(choice) <= len(
                    compatible_biomes) and compatible_biomes[
                        int(choice) - 1].exceed_max(animal) == False:
                print("****   That biome is not large enough   ****")
                print("****     Please choose another one      ****")
                for index, biome in enumerate(compatible_biomes):
                    print(
                        f'{index + 1}. {biome.name} ({len(biome.animals)} animals)'
                    )

                choice = input("Release the animal into which biome? >")
                add_animal(choice)
            # If the number is valid but it doesn't exceed the biome capacity
            elif choice != "" and int(choice) <= len(compatible_biomes):
                return
            # Number that exceeds the length of the comp biomes array
            else:
                input(
                    "\nThat was a bad input, try again next time, fool! \nPress any key to return to the menu..."
                )
                return
        # Value that cant be converted to int like "q"
        except ValueError:
            input(
                "\nThat was a bad input, try again next time, fool! \nPress any key to return to the menu..."
            )
            return

    if compatible_biomes == []:
        input(
            "Sorry, there are no compatible biomes to release this animal into. \nPlease annex a biome in menu option 1. \nPress any key to continue..."
        )
        return

    choice = input("Release the animal into which biome? >")
    add_animal(choice)
def release_animal(arboretum):
    animal = None

    print("1. Gold Dust Day Gecko")
    print("2. River Dolphin")
    print("3. Nene Goose")
    print("4. Kikakapu")
    print("5. Pueo")
    print("6. Ulae")
    print("7. Ope'ape'a")
    print("8. Happy-Face Spider")

    choice = input("Choose animal to release > ")

    if choice == "1":
        animal = DayGecko()
        new_list = []

        if len(arboretum.forests) > 0:
            for index, forest in enumerate(arboretum.forests):
                new_list.append({
                    "index": index,
                    "id": forest.id,
                    "type": "Forest",
                    "animals": forest.animals,
                    "animal_max": forest.animal_max
                })
        valid = False
        while valid == False:
            choice = print_biome(new_list)
            valid = check_capacity(choice)

        if choice["type"] == "Forest" and valid:
            arboretum.forests[int(choice["index"])].add_animal((animal))

    if choice == "2":
        animal = RiverDolphin()
        new_list = []

        if len(arboretum.rivers) > 0:
            for index, river in enumerate(arboretum.rivers):
                new_list.append({
                    "index": index,
                    "id": river.id,
                    "type": "River",
                    "animals": river.animals,
                    "animal_max": river.animal_max
                })

        if len(arboretum.coastlines) > 0:
            for index, coastline in enumerate(arboretum.coastlines):
                new_list.append({
                    "index": index,
                    "id": coastline.id,
                    "type": "Coastline",
                    "animals": coastline.animals,
                    "animal_max": coastline.animal_max
                })

        valid = False
        while valid == False:
            choice = print_biome(new_list)
            valid = check_capacity(choice)

        if choice["type"] == "River" and valid:
            arboretum.rivers[int(choice["index"])].add_animal((animal))

        elif choice["type"] == "Coastline" and valid:
            arboretum.coastlines[int(choice["index"])].add_animal((animal))

    if choice == "3":
        animal = NeneGoose()
        new_list = []

        if len(arboretum.grasslands) > 0:
            for index, grassland in enumerate(arboretum.grasslands):
                new_list.append({
                    "index": index,
                    "id": grassland.id,
                    "type": "Grassland",
                    "animals": grassland.animals,
                    "animal_max": grassland.animal_max
                })

        valid = False
        while valid == False:
            choice = print_biome(new_list)
            valid = check_capacity(choice)

        if choice["type"] == "Grassland" and valid:
            arboretum.grasslands[int(choice["index"])].add_animal((animal))

    if choice == "4":
        animal = Kikakapu()
        new_list = []

        if len(arboretum.rivers) > 0:
            for index, river in enumerate(arboretum.rivers):
                new_list.append({
                    "index": index,
                    "id": river.id,
                    "type": "River",
                    "animals": river.animals,
                    "animal_max": river.animal_max
                })

        if len(arboretum.swamps) > 0:
            for index, swamp in enumerate(arboretum.swamps):
                new_list.append({
                    "index": index,
                    "id": swamp.id,
                    "type": "Swamp",
                    "animals": swamp.animals,
                    "animal_max": swamp.animal_max
                })

        valid = False
        while valid == False:
            choice = print_biome(new_list)
            valid = check_capacity(choice)

        if choice["type"] == "River" and valid:
            arboretum.rivers[int(choice["index"])].add_animal((animal))

        elif choice["type"] == "Swamp" and valid:
            arboretum.swamps[int(choice["index"])].add_animal((animal))

    if choice == "5":
        animal = Pueo()
        new_list = []

        if len(arboretum.grasslands) > 0:
            for index, grassland in enumerate(arboretum.grasslands):
                new_list.append({
                    "index": index,
                    "id": grassland.id,
                    "type": "Grassland",
                    "animals": grassland.animals,
                    "animal_max": grassland.animal_max
                })

        if len(arboretum.forests) > 0:
            for index, forest in enumerate(arboretum.forests):
                new_list.append({
                    "index": index,
                    "id": forest.id,
                    "type": "Forest",
                    "animals": forest.animals,
                    "animal_max": forest.animal_max
                })

        valid = False
        while valid == False:
            choice = print_biome(new_list)
            valid = check_capacity(choice)

        if choice["type"] == "Grassland" and valid:
            arboretum.grasslands[int(choice["index"])].add_animal((animal))

        elif choice["type"] == "Forest" and valid:
            arboretum.forests[int(choice["index"])].add_animal((animal))

    if choice == "6":
        animal = Ulae()
        new_list = []
        if len(arboretum.coastlines) > 0:
            for index, coastline in enumerate(arboretum.coastlines):
                new_list.append({
                    "index": index,
                    "id": coastline.id,
                    "type": "Coastline",
                    "animals": coastline.animals,
                    "animal_max": coastline.animal_max
                })
        valid = False
        while valid == False:
            choice = print_biome(new_list)
            valid = check_capacity(choice)

        if choice["type"] == "Coastline" and valid:
            arboretum.coastlines[int(choice["index"])].add_animal((animal))

    if choice == "7":
        animal = Opeapea()
        new_list = []

        if len(arboretum.forests) > 0:
            for index, forest in enumerate(arboretum.forests):
                new_list.append({
                    "index": index,
                    "id": forest.id,
                    "type": "Forest",
                    "animals": forest.animals,
                    "animal_max": forest.animal_max
                })

        if len(arboretum.mountains) > 0:
            for index, mountain in enumerate(arboretum.mountains):
                new_list.append({
                    "index": index,
                    "id": mountain.id,
                    "type": "Mountain",
                    "animals": mountain.animals,
                    "animal_max": mountain.animal_max
                })

        valid = False
        while valid == False:
            choice = print_biome(new_list)
            valid = check_capacity(choice)

        if choice["type"] == "Forest" and valid:
            arboretum.forests[int(choice["index"])].add_animal((animal))

        elif choice["type"] == "Mountain" and valid:
            arboretum.mountains[int(choice["index"])].add_animal((animal))

    if choice == "8":
        animal = HappyFaceSpider()
        new_list = []

        if len(arboretum.swamps) > 0:
            for index, swamp in enumerate(arboretum.swamps):
                new_list.append({
                    "index": index,
                    "id": swamp.id,
                    "type": "Swamp",
                    "animals": swamp.animals,
                    "animal_max": swamp.animal_max
                })

        valid = False
        while valid == False:
            choice = print_biome(new_list)
            valid = check_capacity(choice)

        if choice["type"] == "Swamp" and valid:
            arboretum.swamps[int(choice["index"])].add_animal((animal))
Ejemplo n.º 11
0
    def step_1():
        os.system('cls' if os.name == 'nt' else 'clear')
        header("Release Animal")

        arboretum_biome_selection = []

        arboretum_biome_selection.append(arboretum.rivers)
        arboretum_biome_selection.append(arboretum.swamps)
        arboretum_biome_selection.append(arboretum.coastlines)
        arboretum_biome_selection.append(arboretum.forests)
        arboretum_biome_selection.append(arboretum.mountains)
        arboretum_biome_selection.append(arboretum.grasslands)

        def all(arboretum_biome_selection):
            for biome in arboretum_biome_selection:
                if len(biome) == 0:
                    return False
                else:
                    return True

        all(arboretum_biome_selection)
        if all(arboretum_biome_selection) == False:
            input(
                "No habitats annexed. Press enter to return to the main menu..."
            )
            return 0
        else:
            print('1. Gold Dust Day Gecko')
            print('2. River Dolphin')
            print('3. Nene Goose')
            print('4. Kīkākapu')
            print('5. Pueo')
            print("6. 'Ulae")
            print("7. Ope'ape'a")
            print("8. Happy-Face Spider")
            print("0. Return to main menu")

            animal = None

            choice = input("Choose animal to release > ")

        if choice == "0":
            return 0

        if choice == "1":
            print("Enter age for Gold Dust Day Gecko : ")
            answer1 = int(input())
            print("Enter name for Gold Dust Day Gecko : ")
            answer2 = input()
            if answer1 is not "" and answer2 is not "":
                animal = GoldDustDayGecko(answer1, answer2)
                step_2(animal)

        if choice == "2":
            print("Enter age for River Dolphin : ")
            answer1 = int(input())
            print("Enter name for River Dolphin : ")
            answer2 = input()
            if answer1 is not "" and answer2 is not "":
                animal = RiverDolphin(answer1, answer2)
                step_2(animal)

        if choice == "3":
            print("Enter age for Nene Goose : ")
            answer1 = int(input())
            print("Enter name for Nene Goose : ")
            answer2 = input()
            if answer1 is not "" and answer2 is not "":
                animal = NeneGoose(answer1, answer2)
                step_2(animal)

        if choice == "4":
            print("Enter age for Kikakapu : ")
            answer1 = int(input())
            print("Enter name for Kikakapu : ")
            answer2 = input()
            if answer1 is not "" and answer2 is not "":
                animal = Kikakapu(answer1, answer2)
                step_2(animal)

        if choice == "5":
            print("Enter age for Pueo : ")
            answer1 = int(input())
            print("Enter name for Pueo : ")
            answer2 = input()
            if answer1 is not "" and answer2 is not "":
                animal = Pueo(answer1, answer2)
                step_2(animal)

        if choice == "6":
            print("Enter age for Ulae : ")
            answer1 = int(input())
            print("Enter name for Ulae : ")
            answer2 = input()
            if answer1 is not "" and answer2 is not "":
                animal = Ulae(answer1, answer2)
                step_2(animal)

        if choice == "7":
            print("Enter age for Opeapea : ")
            answer1 = int(input())
            print("Enter name for Opeapea : ")
            answer2 = input()
            if answer1 is not "" and answer2 is not "":
                animal = Opeapea(answer1, answer2)
                step_2(animal)

        if choice == "8":
            print("Enter age for Hawaiian Happy Face Spider : ")
            answer1 = int(input())
            print("Enter name for Hawaiian Happy Face Spider : ")
            answer2 = input()
            if answer1 is not "" and answer2 is not "":
                animal = HawaiianHappyFaceSpider(answer1, answer2)
                step_2(animal)
def release_animal(arboretum):
    os.system('cls' if os.name == 'nt' else 'clear')
    animal = None

    print("1. Gold Dust Day Gecko")
    print("2. River Dolphin")
    print("3. Nene Goose")
    print("4. Kikakapu")
    print("5. Pueo")
    print("6. Ulae")
    print("7. Ope'ape'a")
    print("8. Happy-Face Spider")

    choice = input("Choose animal to release : ")

    if choice == "1":
        animal = Gecko(12)

    if choice == "2":
        animal = RiverDolphin(12)

    if choice == "3":
        animal = Goose(12)

    if choice == "4":
        animal = Kikakapu(12)

    if choice == "5":
        animal = Pueo(12)

    if choice == "6":
        animal = Ulae(12)

    if choice == "7":
        animal = Opeapea(12)

    if choice == "8":
        animal = Spider(12)

    habitat_list = []

    try:
        if animal.fresh:
            habitat_list.extend(arboretum.rivers)
    except AttributeError:
        pass

    try:
        if animal.stagnant:
            habitat_list.extend(arboretum.swamps)
    except AttributeError:
        pass

    try:
        if animal.salty:
            habitat_list.extend(arboretum.coastlines)
    except AttributeError:
        pass

    try:
        if animal.mountain_bound:
            habitat_list.extend(arboretum.mountains)
    except AttributeError:
        pass

    try:
        if animal.grassland_bound:
            habitat_list.extend(arboretum.grasslands)
    except AttributeError:
        pass

    try:
        if animal.forest_bound:
            habitat_list.extend(arboretum.forests)
    except AttributeError:
        pass

    if len(habitat_list) > 0:
        for index, habitats in enumerate(habitat_list):
            species_count = list()
            species_list = list()
            for species in habitats.animals:
                species_list.append(species.species)
            for animals in set(species_list):
                species_count.append(
                    f"{str(species_list.count(animals))} {animals}")
            print(
                f'{index + 1}. {habitats.type} ({", ".join(species_count) if len(habitats.animals) > 0 else "No animals here"})'
            )
        print("Release the animal into which habitat?")
    else:
        print("There's no habitat for this animal!")

    choice = input("> ")

    if len(habitat_list[int(choice) -
                        1].animals) < habitat_list[int(choice) -
                                                   1].max_animals:
        habitat_list[int(choice) - 1].animals.append(animal)
    else:
        print(
            "**** That Habitat is not large enough **** \n **** Please choose another one ****"
        )
        for index, habitats in enumerate(habitat_list):
            print(
                f'{index + 1}. {habitats.type} ({len(habitats.animals)} animals)'
            )

            print("Release the animal into which Habitat?")
            choice = input(": ")
Ejemplo n.º 13
0
def release_animal(arboretum):
    clear_screen()

    biomes_exist = check_for_biomes(arboretum)
    if not biomes_exist:
        return

    animal = None
    build_menu()

    choice = input("Choose animal to release > ")

    if choice == "1":
        animal = GoldDustDayGecko()

    elif choice == "2":
        animal = RiverDolphin()

    elif choice == "3":
        animal = NeneGoose()

    elif choice == "4":
        animal = Kikakapu()

    elif choice == "5":
        animal = Pueo()

    elif choice == "6":
        animal = Ulae()

    elif choice == "7":
        animal = Opeapea()

    elif choice == "8":
        animal = HawaiianHappyfaceSpider()

    elif choice.upper() == "Q":
        return

    else:
        input('Invalid input. Return to main menu.')
        return
                
    clear_screen()
    # setup dict and display ONLY biomes that the animal choice can go in based on requirements
    choice_dict = dict()

    build_species_biome_option_menu(arboretum, animal, choice_dict)

    # user selects biome type
    if not choice_dict:
        input('No biomes created that this animal can live in.\nPress any key and [Enter] to return to main menu to add one.')
        return

    print(f'Select a biome type to release the {animal.species} into.')
    choice = input("> ")

    # check for valid input choice and return to releas_animal menu if not
    try:
        biome_type = choice_dict[int(choice) - 1]
    except (KeyError, ValueError):
        input("Invalid input. Return to main menu.")
        # release_animal(arboretum)
        return

    # if valid choice, clear screen and proceed with selecting a biome
    clear_screen()

    biome_dict = dict()
    build_biome_menu(arboretum, biome_dict, biome_type)
    # print(biome_dict)
     # if ALL biomes of this type full, return to main menu after notification
    if not biome_dict:
        print(f'All biomes of this type are at max animal capacity.\nAnnex a new {biome_type[:-1]} habitat from the main menu.')
        os.system('say All biomes of this type are at max capacity' if os.name != 'nt' else '')
        input(' >> ')
        return

    print(f'Select the specific {biome_type[:-1]} to release the animal!')
    choice = input("> ")

    try:
        new_home = biome_dict[int(choice) - 1] # this gets the input choice and converts back to zero-indexed choice
    except (KeyError, ValueError, TypeError):
        input("Invalid input. Return to main menu.")
        # release_animal(arboretum)
        return
        
    if len(new_home.animals) < new_home.max_animals:
        new_home.animals.append(animal)
        os.system(f'say you just added a {animal.species} to your {new_home.name}' if os.name != 'nt' else '')
    else:
        print('No space for this animal. Press any key to show all the animals in this biome.')
        os.system(f'say no space for this animal' if os.name != 'nt' else '')
        input(' >> ')

    clear_screen()
    show_biome_animals(new_home)
    input('\nPress any key to return to main menu >>')

    return
    def release_animal(self, choice):

        if choice == "1":
            animal_to_add = GoldDustDayGecko()
            potentialHabitatsForAddedAnimal = [
                forest for forest in self.habitats_dict["Forest"]
            ]

        elif choice == "2":
            animal_to_add = RiverDolphin()
            potentialHabitatsForAddedAnimal = [
                river for river in self.habitats_dict["River"]
            ] + [coastline for coastline in self.habitats_dict["Coastline"]]

        elif choice == "3":
            animal_to_add = NeneGoose()
            potentialHabitatsForAddedAnimal = [
                grassland for grassland in self.habitats_dict["Grassland"]
            ]

        elif choice == "4":
            animal_to_add = Kikakapu()
            potentialHabitatsForAddedAnimal = [
                river for river in self.habitats_dict["River"]
            ] + [swamp for swamp in self.habitats_dict["Swamp"]]

        elif choice == "5":
            animal_to_add = Pueo()
            potentialHabitatsForAddedAnimal = [
                grassland for grassland in self.habitats_dict["Grassland"]
            ] + [forest for forest in self.habitats_dict["Forest"]]

        elif choice == "6":
            animal_to_add = Ulae()
            potentialHabitatsForAddedAnimal = [
                coastline for coastline in self.habitats_dict["Coastline"]
            ]

        elif choice == "7":
            animal_to_add = Opeapea()
            potentialHabitatsForAddedAnimal = [
                forest for forest in self.habitats_dict["Forest"]
            ] + [mountain for mountain in self.habitats_dict["Mountain"]]

        elif choice == "8":
            animal_to_add = HappyFaceSpider()
            potentialHabitatsForAddedAnimal = [
                swamp for swamp in self.habitats_dict["Swamp"]
            ]

        else:
            print("That is not a valid choice.")
            return

        for i, v in enumerate(potentialHabitatsForAddedAnimal):

            valid_habitat = len(v.animals) < v.animal_limit

            if not valid_habitat:
                print('')
            else:
                print(
                    f'{i + 1}. {type(v).__name__} ({len(v.animals)} animals)')

        # Prompts the user to select a habitat
        print(f"\nWhere would you like to release the {animal_to_add.species}")
        choice = input("> ")

        if int(choice) > len(potentialHabitatsForAddedAnimal):
            print("That is not a valid choice.")
            return

        targetHabitat = potentialHabitatsForAddedAnimal[int(choice) - 1]

        habitatTargetList = self.habitats_dict[type(targetHabitat).__name__]
        object_class_animal_to_add = habitatTargetList[habitatTargetList.index(
            targetHabitat)]

        if len(object_class_animal_to_add.animals
               ) < object_class_animal_to_add.animal_limit:
            object_class_animal_to_add.add_animal(animal_to_add)
            print(
                f"You have added an {animal_to_add.species} to {type(targetHabitat).__name__}"
            )

        else:
            print(
                "That habitat is already at it's max for animals. Please choose another habitat"
            )