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

    dolphin = RiverDolphin()
    dolphin_prey = dolphin.prey
    feeding_time = sorted(list(dolphin_prey))

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

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

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

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

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

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

    choice = input("\nPress any key to go back.\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}!")
示例#3
0
def release_animal(arboretum):
    os.system('cls' if os.name == 'nt' else 'clear')

    animal = None
    placement = None

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

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

    if choice == "1":
        animal = GoldDustDayGecko()
        arboretum.gold_dust_day_gecko.append(animal)
        placement = "gecko"

    if choice == "2":
        animal = NeneGoose()
        arboretum.nene_goose.append(animal)
        placement = "goose"

    if choice == "3":
        animal = Kikakapu()
        arboretum.kikakapu.append(animal)
        placement = "kikakapu"

    if choice == "4":
        animal = Opeapea()
        arboretum.opeapea.append(animal)
        placement = "opeapea"

    if choice == "5":
        animal = Pueo()
        arboretum.pueo.append(animal)
        placement = "pueo"

    if choice == "6":
        animal = RiverDolphin()
        arboretum.river_dolphins.append(animal)
        placement = "river_dolphin"

    if choice == "7":
        animal = HappyFaceSpider()
        arboretum.happy_face_spider.append(animal)
        placement = "spider"

    if choice == "8":
        animal = Ulae()
        arboretum.ulae.append(animal)
        placement = "ulae"

    choose_environment(arboretum, animal, placement)
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_menu(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. Kīkākapu")
    print("5. Pueo")
    print("6. 'Ulae")
    print("7. Ope'ape'a")
    print("8. Happy-Face Spider")
    print()
    print("Choose an animal to feed.")
    choice = input("> ")
    try:
        int(choice) == int
        if int(choice) > 0 and int(choice) < 9:
            if choice == "1":
                animal = GoldDustDayGecko()
                feed_animal(animal)
            if choice == "2":
                animal = RiverDolphin()
                feed_animal(animal)
            if choice == "3":
                animal = NeneGoose()
                feed_animal(animal)
            if choice == "4":
                animal = Kikakapu()
                feed_animal(animal)
            if choice == "5":
                animal = Pueo()
                feed_animal(animal)
            if choice == "6":
                animal = Ulae()
                feed_animal(animal)
            if choice == "7":
                animal = Opeapea()
                feed_animal(animal)
            if choice == "8":
                animal = HappyFaceSpider()
                feed_animal(animal)
        else:
            input("Please select a valid entry, the animals are hungry. Press any key to return to the main menu... ")
    except ValueError:
        print()
        error_message = input("Animals can't eat letters. Press any key to return to the main menu... ")
    except IndexError:
        print()
        error_message = input("Please select a valid entry, the animals are hungry. Press any key to return to the main menu... ")
示例#7
0
def release_animal(arboretum):
    print("1. River Dolphin")
    print("2. Dragonfly")

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

    if choice == "1":
        dolphin = RiverDolphin()
        count = 1
        for river in arboretum.rivers:
            print(f"{str(count)}. {river}")
            count += 1
        for coastline in arboretum.coastlines:
            print(f"{str(count)}. {coastline}")
        dolphin_choice = input("Choose where to release your river dolphin > ")

    if choice == "2":
        pass
示例#8
0
def release_animal(arboretum):
    animal = None

    print("1. River Dolphin")
    print("2. Dragonfly")

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

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

    if choice == "2":
        pass

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

    print("Release the animal into which biome?")
    choice = input("> ")

    arboretum.rivers[int(choice) - 1].animals.append(animal)
示例#9
0
def release_animal(arboretum):
    build_release_animal_menu()
    animal = None
    choice = input("Choose 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 = HappyFacedSpider()
    build_biome_choices(animal, arboretum, True)
    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)
def release_animal(arboretum):
    animal = None
    # clears the screen
    os.system("cls" if os.name == "nt" else "clear")

    # Printing the header
    print(''' +-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-+
 |  K  e  a  h  u  a    A  r  b  o  r  e  t  u  m  |
 +-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-+\n''')

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

    # Capturing user input and assigning it to "choice" variable
    choice = input('''
Choose an animal to release or
Type M to return to the main menu.

> ''')

    if choice == "1":
        animal = RiverDolphin()
        create_animal_two_habitats(arboretum.rivers, arboretum.coastlines,
                                   arboretum, animal)

    if choice == "2":
        os.system("cls" if os.name == "nt" else "clear")
        animal = GDDGecko()
        create_animal_one_habitat(arboretum.forests, arboretum, animal)

    if choice == "3":
        os.system("cls" if os.name == "nt" else "clear")
        animal = nenegoose()
        create_animal_one_habitat(arboretum.grasslands, arboretum, animal)

    if choice == "4":
        os.system("cls" if os.name == "nt" else "clear")
        animal = Kikakapu()
        create_animal_two_habitats(arboretum.rivers, arboretum.swamps,
                                   arboretum, animal)

    if choice == "5":
        os.system("cls" if os.name == "nt" else "clear")
        animal = Pueo()
        create_animal_two_habitats(arboretum.grasslands, arboretum.forests,
                                   arboretum, animal)

    if choice == "6":
        os.system("cls" if os.name == "nt" else "clear")
        animal = Ulae()
        create_animal_one_habitat(arboretum.coastlines, arboretum, animal)

    if choice == "7":
        os.system("cls" if os.name == "nt" else "clear")
        animal = Opeapea()
        create_animal_two_habitats(arboretum.mountains, arboretum.forests,
                                   arboretum, animal)

    if choice == "8":
        os.system("cls" if os.name == "nt" else "clear")
        animal = HHFSpider()
        create_animal_one_habitat(arboretum.swamps, arboretum, animal)
def feed_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 feed > ")

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

        animal.list_prey()
        choice = input(f'What is on the menu for the {animal.species} today?')

        choice = int(choice) - 1
        choice = animal.prey[choice]
        animal.feed(f"{choice}")
        input("Press any key to continue")

    if choice == "2":
        animal = RiverDolphin()
        animal.list_prey()
        choice = input(f'What is on the menu for the {animal.species} today?')

        choice = int(choice) - 1
        choice = animal.prey[choice]
        animal.feed(f"{choice}")
        input("Press any key to continue")

    if choice == "3":
        animal = NeneGoose()
        animal.list_prey()
        choice = input(f'What is on the menu for the {animal.species} today?')

        choice = int(choice) - 1
        choice = animal.prey[choice]
        animal.feed(f"{choice}")
        input("Press any key to continue")

    if choice == "4":
        animal = Kikakapu()
        animal.list_prey()
        choice = input(f'What is on the menu for the {animal.species} today?')

        choice = int(choice) - 1
        choice = animal.prey[choice]
        animal.feed(f"{choice}")
        input("Press any key to continue")

    if choice == "5":
        animal = Pueo()
        animal.list_prey()
        choice = input(f'What is on the menu for the {animal.species} today?')

        choice = int(choice) - 1
        choice = animal.prey[choice]
        animal.feed(f"{choice}")
        input("Press any key to continue")

    if choice == "6":
        animal = Ulae()
        animal.list_prey()
        choice = input(f'What is on the menu for the {animal.species} today?')

        choice = int(choice) - 1
        choice = animal.prey[choice]
        animal.feed(f"{choice}")
        input("Press any key to continue")

    if choice == "7":
        animal = Opeapea()
        animal.list_prey()
        choice = input(f'What is on the menu for the {animal.species} today?')

        choice = int(choice) - 1
        choice = animal.prey[choice]
        animal.feed(f"{choice}")
        input("Press any key to continue")

    if choice == "8":
        animal = HappyFaceSpider()
        animal.list_prey()
        choice = input(f'What is on the menu for the {animal.species} today?')

        choice = int(choice) - 1
        choice = animal.prey[choice]
        animal.feed(f"{choice}")
        input("Press any key to continue")
示例#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(arboretum):

    biome_list = arboretum.rivers + arboretum.swamps + arboretum.grasslands + \
        arboretum.forests + arboretum.coastlines + arboretum.mountains

    print("+-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-")
    print("+ C H O O S E  A N I M A L  F O R  R E L E A S E +")
    print("+-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-++-")

    print('1. Gold Dust Day Gecko')
    print('2. Happy Faced Spider')
    print('3. Kikakapu')
    print('4. Nene Goose')
    print('5. Opeapea')
    print('6. Pueo')
    print('7. River Dolphin')
    print('8. Ulae')

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

    if choice == "1":
        gold_dust_day_gecko = GoldDustDayGecko()
        arboretum.gold_dust_day_geckos.append(gold_dust_day_gecko)
        animal = river_dolphin
    if choice == "2":
        happy_faced_spider = HappyFacedSpider()
    if choice == "3":
        kikakapu = Kikakapu()
    if choice == "4":
        nene_goose = NeneGoose()
    if choice == "5":
        opeapea = Opeapea()
    if choice == "6":
        pueo = Pueo()
    if choice == "7":
        river_dolphin = RiverDolphin()
        arboretum.river_dolphins.append(river_dolphin)
        animal = river_dolphin
    if choice == "8":
        ulae = Ulae()

    print("Release the animal into which biome?")

    counter = 0
    for river in arboretum.rivers:
        print(f'{counter + 1}. River [{river.id}]')
        counter += 1
    for swamp in arboretum.swamps:
        print(f'{counter + 1}. Swamp [{swamp.id}]')
        counter += 1
    for grassland in arboretum.grasslands:
        print(f'{counter + 1}. Grassland [{grassland.id}]')
        counter += 1
    for forest in arboretum.forests:
        print(f'{counter + 1}. Forest [{forest.id}]')
        counter += 1
    for coastline in arboretum.coastlines:
        print(f'{counter + 1}. Coastline [{coastline.id}]')
        counter += 1
    for mountain in arboretum.mountains:
        print(f'{counter + 1}. Mountain [{mountain.id}]')
        counter += 1

    choice = int(input("> "))

    biome_list[choice - 1].add_animal(animal)

    print(
        f"{animal.species} [{animal.id}] was added to {biome_list[choice - 1].name} [{biome_list[choice - 1].id}]"
    )

    input('Press enter to continue...')
keahua.add_biome(Coastline("Coastline 1"))
keahua.add_biome(Coastline("Coastline 2"))

keahua.add_biome(Swamp("Swamp 1"))
keahua.add_biome(Swamp("Swamp 2"))

keahua.add_biome(Forest("Forest 1"))
keahua.add_biome(Forest("Forest 2"))

keahua.add_biome(Grassland("Grassland 1"))
keahua.add_biome(Grassland("Grassland 2"))

keahua.add_biome(Mountain("Mountain 1"))
keahua.add_biome(Mountain("Mountain 2"))

keahua.rivers[0].add_animal(RiverDolphin())
keahua.rivers[0].add_animal(RiverDolphin())
keahua.rivers[0].add_animal(RiverDolphin())
keahua.rivers[0].add_animal(Kikakapu())
keahua.rivers[0].add_animal(Kikakapu())
keahua.rivers[0].add_animal(Kikakapu())
keahua.rivers[0].add_animal(Kikakapu())

gecko = Gecko()
print(gecko)


def build_menu():
    # os.system('cls' if os.name == 'nt' else 'clear')
    print("1. Annex Habitat")
    print("2. Release Animal into Habitat")
示例#16
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)
示例#17
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)
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(": ")
def release_animal(arboretum):
    display_banner()
    animal = None

    print("1. River Dolphin")
    print("2. Dragonfly")

    choice = input("Choose animal to release > ")
    option_list = []
    if choice == "1":
        animal = RiverDolphin()

    if choice == "2":
        pass

    display_banner()

    def print_habitats():
        option_list = []

        biome_list_maker(
            animal.aquatic and animal.cell_type == "hypertonic"
            or animal.cell_type == "isotonic", arboretum.rivers, option_list,
            animal)

        biome_list_maker(
            animal.aquatic and animal.cell_type == "hypotonic"
            or animal.cell_type == "isotonic", arboretum.coastlines,
            option_list, animal)

        for index, dic in enumerate(option_list):
            print(f'{index + 1}. {dic["biome"].print_list_options()}')
            # print(f'{index + 1}. {dic["biome"].name} ({dic["biome"].animal_count()} {"animal" if dic["biome"].animal_count() == 1 else "animals"})')

        option_list_length = len(option_list)
        if option_list_length == 0:
            print(
                "All of your Biomes are at maximum capacity please create a new biome!"
            )
            input("\n\nPress any key to go back to the main menu...")
        else:
            print(f"{option_list_length + 1}. Main Menu")
            print("Release the animal into which biome?")
            choice = input("> ")
            if int(choice) == option_list_length + 1:
                return
            elif choice.isnumeric():

                choice_input = int(choice)

                choice_biome = option_list[choice_input - 1]

                if choice_input <= option_list_length:
                    choice_biome["biome"].add_animal(animal)
                else:
                    display_banner()
                    print(
                        f"{choice_input} is not an option. Please choose an option that is available!"
                    )
                    print_habitats()
            else:
                display_banner()
                print(
                    f"{choice} is not an option. Please choose an option that is available!"
                )
                print_habitats()

    print_habitats()
示例#20
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)
示例#21
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...")
    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"
            )
示例#23
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>_")
def release_animal(arboretum):
    valid_option = True
    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. Kīkākapu")
    print("5. Pueo")
    print("6. 'Ulae")
    print("7. Ope'ape'a")
    print("8. Happy-Face Spider")
    print()
    print("Choose animal.")
    choice = input("> ")
    try:
        if int(choice) > 0 and int(choice) < 9:
            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 = HappyFaceSpider()
        else:
            pass
    except KeyError:
        os.system('cls' if os.name == 'nt' else 'clear')
        valid_option = False
        input(
            "Please enter a valid option next time. Press enter to return to the main menu..."
        )
    except AttributeError:
        os.system('cls' if os.name == 'nt' else 'clear')
        valid_option = False
        input(
            "Please enter a valid option next time. Press enter to return to the main menu..."
        )
    except ValueError:
        os.system('cls' if os.name == 'nt' else 'clear')
        valid_option = False
        input(
            "Please enter a valid option next time. Press enter to return to the main menu..."
        )

    biome = dict()

    def menu_function():
        num = 1
        try:
            int(choice) == int
            if int(choice) > 0 and int(choice) < 9:
                for index, river in enumerate(arboretum.rivers):
                    if river.max_animals > len(river.animals):
                        print(f'{num}. River ({len(river.animals)} animals)')
                        biome[num] = arboretum.rivers[index]
                        num += 1

                for index, mountain in enumerate(arboretum.mountains):
                    if mountain.max_animals > len(mountain.animals):
                        print(
                            f'{num}. Mountain ({len(mountain.animals)} animals)'
                        )
                        biome[num] = arboretum.mountains[index]
                        num += 1

                for index, swamp in enumerate(arboretum.swamps):
                    if swamp.max_animals > len(swamp.animals):
                        print(f'{num}. Swamp ({len(swamp.animals)} animals)')
                        biome[num] = arboretum.swamps[index]
                        num += 1

                for index, grassland in enumerate(arboretum.grasslands):
                    if grassland.max_animals > len(grassland.animals):
                        print(
                            f'{num}. Grassland ({len(grassland.animals)} animals)'
                        )
                        biome[num] = arboretum.grasslands[index]
                        num += 1

                for index, forest in enumerate(arboretum.forests):
                    if forest.max_animals > len(forest.animals):
                        print(f'{num}. Forest ({len(forest.animals)} animals)')
                        biome[num] = arboretum.forests[index]
                        num += 1

                for index, coastline in enumerate(arboretum.coastlines):
                    if coastline.max_animals > len(coastline.animals):
                        print(
                            f'{num}. Coastline ({len(coastline.animals)} animals)'
                        )
                        biome[num] = arboretum.coastlines[index]
                        num += 1

            for index, volcano in enumerate(arboretum.volcano):
                print(f'{num}. Throw it in the volcano.')
                biome[num] = arboretum.volcano[index]
                num += 1

        except KeyError:
            os.system('cls' if os.name == 'nt' else 'clear')
            input(
                "Please enter a valid option next time. Press enter to return to the main menu..."
            )
        except AttributeError:
            os.system('cls' if os.name == 'nt' else 'clear')
            input(
                "Please enter a valid option next time. Press enter to return to the main menu..."
            )
        except ValueError:
            os.system('cls' if os.name == 'nt' else 'clear')
            input(
                "Please enter a valid option next time. Press enter to return to the main menu..."
            )

    if valid_option:
        menu_function()
        print()
        print("Where would you like to place the animal?")
        choice = input("> ")

    try:
        env = biome[int(choice)]

        def choice_fn(environment):
            try:
                environment.add_animal(animal)
            except ValueError:
                os.system('cls' if os.name == 'nt' else 'clear')
                input(
                    "The environment is not suitable for that animal. Press any key to continue..."
                )
                pass
            except KeyError:
                os.system('cls' if os.name == 'nt' else 'clear')
                input(
                    "The environment is not suitable for that animal. Press any key to continue..."
                )
                pass
            except AttributeError:
                os.system('cls' if os.name == 'nt' else 'clear')
                input(
                    "The environment is not suitable for that animal. Press any key to continue..."
                )
                pass

        choice_fn(env)
    except ValueError:
        pass
    except KeyError:
        pass
    except AttributeError:
        pass
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))