def build_menu(): ''' Title Menu with options list ''' print_banner() print("MAIN MENU:") print("") # MAIN MENU print("1. Annex Biome") print("2. Release New Animal") print("3. Feed Animal") print("4. Cultivate New Plant") print("5. Show Arboretum Report") print("6. Exit") print("")
def annex_habitat(arboretum): print_banner() # MENU OPTIONS print("HABITAT OPTIONS:") print("") print("1. River") print("2. Swamp") print("3. Coastline") print("4. Grassland") print("5. Mountain") print("6. Forest") print("") choice = input("Choose habitat to annex >> ") print("") if choice == "1": name = input("Enter a name for your River >> ") river = River(name) arboretum.rivers.append(river) if choice == "2": name = input("Enter a name for your Swamp >> ") swamp = Swamp(name) arboretum.swamps.append(swamp) if choice == "3": name = input("Enter a name for your Coastline >> ") coastline = Coastline(name) arboretum.coastlines.append(coastline) if choice == "4": name = input("Enter a name for your Grassland >> ") grassland = Grassland(name) arboretum.grasslands.append(grassland) if choice == "5": name = input("Enter a name for your Mountain >> ") mountain = Mountain(name) arboretum.mountains.append(mountain) if choice == "6": name = input("Enter a name for your Forest >> ") forest = Forest(name) arboretum.forests.append(forest)
def build_facility_report(arboretum): print_banner() print(f"KEAHUA ARBORETUM - FACILITY REPORT") print("----------------------------------") print("") def printEnvironment(env_type, environment): print(f'{env_type} - {environment} [{str(environment.id)[:8]}]') if len(environment.animals) > 0: print(" Animals:") for animal in environment.animals: print(f' {animal}') if len(environment.plants) > 0: print(" Plants:") for plant in environment.plants: print(f' {plant}') for river in arboretum.rivers: printEnvironment("River", river) for swamp in arboretum.swamps: printEnvironment("Swamp", swamp) for mountain in arboretum.mountains: printEnvironment("Mountain", mountain) for grassland in arboretum.grasslands: printEnvironment("Grassland", grassland) for coastline in arboretum.coastlines: printEnvironment("Coastline", coastline) for forest in arboretum.forests: printEnvironment("Forest", forest) input("\n\nPress any key to continue...")
def feed_animal(arboretum): animal = None print_banner() # MENU print("ANIMAL FEED 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") choice = input("Choose the animal type you want to feed >> ") # get all the animals based on the class selected animals_by_selected_class = [] biomes = [ arboretum.rivers, arboretum.swamps, arboretum.grasslands, arboretum.mountains, arboretum.coastlines, arboretum.forests ] def find_all_animals_by_class(animalclass): for biome in biomes: for environment in biome: for animal in environment.animals: if isinstance(animal, animalclass): animals_by_selected_class.append(animal) if choice == "1": find_all_animals_by_class(GoldDustDayGecko) if choice == "2": find_all_animals_by_class(RiverDolphin) if choice == "3": find_all_animals_by_class(NeneGoose) if choice == "4": find_all_animals_by_class(Kikakapu) if choice == "5": find_all_animals_by_class(Pueo) if choice == "6": find_all_animals_by_class(Ulae) if choice == "7": find_all_animals_by_class(Opeapea) if choice == "8": find_all_animals_by_class(HawaiianHappyFaceSpider) # if choice == "9": # find_all_animals_by_class(RainbowTrout) # GENERATE NUMBERED LIST OF AVAILABLE ANIMALS TO FEED for index, animal in enumerate(animals_by_selected_class): print(f'{index + 1}. {animal}') # PROMPT USER TO SELECT ANIMAL print(f"Select an animal to feed >> ") choice = input(">> ") # STORE SELECTED ANIMAL selected_animal = animals_by_selected_class[int(choice) - 1] # convert animal prey set to list options = list(selected_animal.prey) # GENERATE NUMBERED LIST OF FEED OPTIONS for index, option in enumerate(options): print(f'{index + 1}. {option}') # Handle if user has no options if len(options) > 0: # prompt user to select food for animal print(f"What is on the menu for the {animal} today?") choice = input(">> ") # TODO check input is a valid option # feed animal animal.feed(options[int(choice) - 1]) input("\n\nPress any key to continue...") else: print("No food available for this animal.") print("Select a different animal.") input("\n\nPress any key to continue...")
def cultivate_plant(arboretum): # initial plant variable plant = None print_banner() print("PLANT CULTIVATING OPTIONS:") print("") print("1. Mountain Apple Tree") print("2. Silversword") print("3. Rainbow Eucalyptus Tree") print("4. Blue Jade Vine") print("") choice = input("Choose plant to cultivate >> ") if choice == "1": # plant = MountainApple() pass if choice == "2": # plant = Silversword() pass if choice == "3": plant = RainbowEucalyptus() print(plant) input("\n\nPress enter to continue...") if choice == "4": # plant = BlueJadeVine() pass # 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.plants) < environment.plant_max: options.append(environment) # iterate options list to create menu options for index, option in enumerate(options): print(f'{index + 1}. {option} ({len(option.plants)} plants)') # Handle if user has no options if len(options) > 0: # prompt user to place plant print("Cultivate the plant in which biome?") choice = input("> ") # TODO check input is a valid option if int(choice) > 0 and int(choice) <= len(options) + 1: # place plant in selected biome list options[int(choice) - 1].add_plant(plant) else: print("Invalid Entry") input("\n\nPress enter to continue...") else: print("No biomes available for this plant.") print("Select a different plant or annex a new biome.") input("\n\nPress enter to continue...")
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...")