def test_shark_moveto_fish(self): s_test = Shark([1, 1]) f = [] f1 = [[0, 1], [1, 0], [1, 2], [2, 1]] f2 = [[0, 1], [1, 0], [1, 2]] f3 = [[1, 2], [2, 1]] f4 = [[2, 1]] # surrounding = [[0,1],[1,0],[1,2],[2,1]] self.assertEqual(s_test.move_to_fish(f), None) for _ in range(100): self.assertIn(s_test.move_to_fish(f1), [[0, 1], [1, 0], [1, 2], [2, 1]]) self.assertIn(s_test.move_to_fish(f2), [[0, 1], [1, 0], [1, 2]]) self.assertIn(s_test.move_to_fish(f3), [[1, 2], [2, 1]]) self.assertIn(s_test.move_to_fish(f4), [[2, 1]])
from .attractions import PettingZoo, Wetlands, SnakePit from animals import Goose, Python, Crocodile, Salamander, Anaconda, Gecko, StingRay, Goldfish, Catfish, Otter, Shark, Llama, Goat, Horse, Pig, Cow silk = Python("Silk", "python", "mouse") jaws = Crocodile("Jaws", "crocodile", "rat") sammy = Salamander("Sammy", "salamander", "lizard food") nicki = Anaconda("Nicki", "anaconda", "rat") geiko = Gecko("Geiko", "gecko", "lizard food") ray = StingRay("Ray", "stingray", "ray food") nemo = Goldfish("Nemo", "goldfish", "fish food") feline = Catfish("Feline", "catfish", "worms") tubs = Otter("Tubs", "otter", "small fish") bruce = Shark("Bruce", "Great White Shark", "small fish") kevin = Llama("Kevin", "domesticated Llama", "morning", "llama food") gary = Goat("Gary", "billy-goat", "mid-day", "goat food") chester = Horse("Chester", "stallion", "afternoon", "hay") oinky = Pig("Oinky", "pot-belly", "morning", "oats") bessy = Cow("Bessy", "milking cow", "afternoon", "grass") bob = Goose("Bob", "Canada goose", "watercress sandwiches") bob.run() bob.swim() varmit_village = PettingZoo("Varmit Village") crocodile_valley = SnakePit("Crocodile Valley") crocodile_valley.add_animals(jaws) crocodile_valley.add_animals(sammy) crocodile_valley.add_animals(nicki)
print(Dipper) Dipper.feed() Wally = Gator("Wally", "Hanna Barbera Gator", "large children", 11) print(Wally) Wally.feed() Cuddles = Gar("Cuddles", "Eastern Brim Killer Gar", "Nemo", 12) print(Cuddles) Cuddles.feed() Pickles = Beaver("Pickles", "Angry Beaver", "steroids", 13) print(Pickles) Pickles.feed() JabberJaws = Shark("Jabber Jaws", "Great White Shark", "bachelorettes", 14) print(JabberJaws) JabberJaws.feed() Mechazilla = Godzilla("Mechazilla", "Robot", "a cold fusion reactor", 15) print(Mechazilla) Mechazilla.feed() def report_animals_by_attractions(*attractions): for attraction in attractions: print(f'{attraction.attraction_name} is where you can find {attraction.description} ') for animal in attraction.animals: print(f'* {animal.name} the {animal.species}.')
steve_url = Copperhead("Steve Url", "copperhead", "snake pellets", 1) lucy = Diamondback("Lucy", "diamondback", "cashews", 2) donkeh = Donkey("Donkeh", "donkey", "morning", "waffles", 3) fsh = Fish_With_No_Eyes("Fsh", "fish with no eyes", "carrots", 4) g****e = Goat("G****e", "goat", "afternoon", "goat snacks", 5) silver = Goldfish("Silver", "goldfish", "Goldfish", 6) euryale = Gorgon("Euryale", "gorgon", "gorgonzola", 7) mav = Goose("Mav", "Canada goose", "watercress sandwiches", 16) peanut_butter = Jellyfish("Peanut Butter", "jellyfish", "sandwiches", 8) miss_fuzz = Llama("Miss Fuzz", "llama", "evening", "llamagranates", 9) mallory = Mallard("Mallory", "mallard", "mallort", 10) tang = Orangutan("Tang", "orangutan", "midnight", "Tang", 11) snat_rake = Rat_Snake("Snat Rake", "rat snake", "Rat Snacks(TM)", 12) maracas = Rattlesnake("Maracas", "rattlesnake", "rattlesnacks", 13) jaws = Shark("Jaws", "shark", "bigger boats", 14) little_sebastian = Small_Horse("Little Sebastian", "small horse", "sunrise", "hay-zelnuts", 15) varmint_village = PettingZoo("Varmint Village", "cute and fuzzy critters to cuddle") snake_hole = SnakePit("The Snake Hole", "unlovable and slithery critters to avoid") soggy_bottoms = Wetlands("Soggy Bottoms", "wet and wild critters in your area") varmint_village.add([donkeh, g****e, miss_fuzz, tang, little_sebastian]) snake_hole.add([steve_url, lucy, euryale, snat_rake, maracas]) soggy_bottoms.add([fsh, silver, peanut_butter, mallory, jaws]) varmint_village.add_animal_type_check(mav)
from animals import Goat, Goose, Llama, Shark, Pig, Snake from attractions import PettingZoo bob = Goose("Bob", "Canada goose", "watercress sandwiches", 243234) bob.run() bob.swim() snappy = Shark("Snappy", "Great White", "Fingers", 2342352) varmint_village = PettingZoo("Varmint Village", "critters that like to dig and scurry") varmint_village.add_animal(bob) varmint_village.add_animal(snappy) print(varmint_village) for animal in varmint_village.animals: print(animal)
from attractions import PettingZoo, Wetlands, SnakePit, Attraction from datetime import date import json mama = Llama(1, "Mama Llama", "domestic llama","morning", "llama chow") billy = Goat(2, "Billy", "domestic goat", "midday", "goat chow") waffles = Donkey(3, "Waffles", "domestic donkey", "afternoon", "donkey chow") chris = Pig(4,"Chris P Bacon", "domestic pig", "morning", "pig chow") para = Ox(5, "Para 'D' Ox", "domestic ox", "midday", "ox chow") # goose = Goose(16, "Goose the Goose", "domestic goose", "goose chow") dude = SeaTurtle(6, "Dude", "domestic sea turtle") shocky = Eel(7, "Shocky", "domestic eel") towel = Dolphin(8, "Towel", "domestic dolphin") finn = Shark(9, "Finn", "domestic shark") boo = Whale(10,"Boo You Whale", "domestic whale") cheese = Ratsnake(11, "Cheese", "domestic ratsnake") bronze = Copperhead(12, "Bronze", "domestic copperhead") monty = Python(13, "Monty", "domestic python") shake = Rattlesnake(14,"Shake", "domestic rattlesnake") louis = Kingsnake(15, "King Louis", "domestic kingsnake") varmint_village = PettingZoo("Varmint Village", "cute and fuzzy critters to cuddle") pit_of_doom = SnakePit("Pit of Doom", "cute and scaley critters") waterworld = Wetlands("Waterworld", "cute and wet critters") varmint_village.add_animal(mama) varmint_village.add_animal(billy) varmint_village.add_animal(waffles)
def main(): petting_zoo = PettingZoo('Petting Zoo', 'Pet Pet Pet') snakepit = Snakepit("Creepy Crawlers", "Keep your hands outside of the tanks") aquarium = Wetlands("Awesome Aquatics", "Sharks, Whales, and Tunas Oh MY") miss_fuzz = Llama("Miss Fuzz", "Domestic Llama", "Morning", "Grass", 92549) george = Monkey("George", "Howler Monkey", "Afternoon", "Bananas", 39181) gregory = Giraffe("Gregory", "Spotted Giraffe", "Midday", "Carrots", 76876) donnie = Donkey("Donnie", "Catalan Donkey", "Morning", "Hay", 23648) helen = Horse("Helen", "Arabian Horse", "Afternoon", "Apples", 54921) randy = Rattlesnake("Randy", "Texas Rattlesnake", "Mice", 81625) mary = Mamba("Mary", "Black Mamba", "Gerbils", 71603) vinnie = Viper("Vinnie", "Viper", "Lizzards", 49816) kerry = Kingsnake("Kerry", "King Snake", "Turtle Eggs", 19254) carlos = Cobra("Carlos", "King Cobra", "Hamster", 12345) debra = Dolphin("Debra", "Striped Dolphin", "Squids", 5678) walker = Whale("Walker", "Killer Whale", "Penguins", 41376) sarah = Shark("Sarah", "Great White Shark", "Seals", 59175) gary = Goldfish("Gary", "Lionhead Goldfish", "Fish Food", 28922) tina = Tuna("Tina", "Blackfin Tuna", "Shrimp", 43819) petting_zoo.append_animal(miss_fuzz) petting_zoo.append_animal(george) petting_zoo.append_animal(gregory) petting_zoo.append_animal(donnie) petting_zoo.append_animal(helen) petting_zoo.append_animal(debra) # Will Not Append. snakepit.append_animal(randy) snakepit.append_animal(mary) snakepit.append_animal(vinnie) snakepit.append_animal(kerry) snakepit.append_animal(carlos) snakepit.append_animal(helen) # Will Not Append. aquarium.append_animal(debra) aquarium.append_animal(walker) aquarium.append_animal(sarah) aquarium.append_animal(gary) aquarium.append_animal(tina) aquarium.append_animal(randy) # Will Not Append. for animal in petting_zoo.animals: print( f'You can find {animal.name} the {animal.species} in {petting_zoo.name}' ) for animal in snakepit.animals: print( f'You can find {animal.name} the {animal.species} in {snakepit.name}' ) for animal in aquarium.animals: print( f"You can find {animal.name} the {animal.species} in {aquarium.name}" ) donnie.chipnum = 12334 print(donnie.chipnum) print(aquarium.last_critter_added) print(carlos) donnie.feed() randy.feed() sarah.feed() sarah.swim()