本文整理汇总了Python中species.Species.largest_fatty_need方法的典型用法代码示例。如果您正苦于以下问题:Python Species.largest_fatty_need方法的具体用法?Python Species.largest_fatty_need怎么用?Python Species.largest_fatty_need使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类species.Species
的用法示例。
在下文中一共展示了Species.largest_fatty_need方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: feed_fatty
# 需要导入模块: from species import Species [as 别名]
# 或者: from species.Species import largest_fatty_need [as 别名]
def feed_fatty(cls, fat_tissue_species, food_available):
"""
Feeds a species with the fat-tissue trait
:param fat_tissue_species: species with a fat-tissue trait
:param food_available: food on the watering_hole_board
:return: list of [Species, int] where Species is the fat_tissue_species and int is the requested food
"""
fatty = Species.largest_fatty_need(fat_tissue_species)
food_requested = (fatty.body if fatty.body < food_available else food_available)
return [fatty, food_requested]
示例2: test_largest_fatty_need
# 需要导入模块: from species import Species [as 别名]
# 或者: from species.Species import largest_fatty_need [as 别名]
def test_largest_fatty_need(self):
self.species_1.traits = [TraitCard("fat-tissue")]
self.species_2.traits = [TraitCard("fat-tissue")]
self.species_4.traits = [TraitCard("fat-tissue")]
self.assertEqual(Species.largest_fatty_need([self.species_1, self.species_4]), self.species_4)
self.assertEqual(Species.largest_fatty_need([self.species_1, self.species_2]), self.species_1)