本文整理匯總了Python中Darwin.Darwin.if_empty方法的典型用法代碼示例。如果您正苦於以下問題:Python Darwin.if_empty方法的具體用法?Python Darwin.if_empty怎麽用?Python Darwin.if_empty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Darwin.Darwin
的用法示例。
在下文中一共展示了Darwin.if_empty方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_Darwin_10
# 需要導入模塊: from Darwin import Darwin [as 別名]
# 或者: from Darwin.Darwin import if_empty [as 別名]
def test_Darwin_10(self):
assert hasattr(Darwin, "if_enemy")
game = Darwin(5,5)
food = Species("food")
c = Creature(food)
space = Species(".")
game.place_creature(c,2,2,"east")
self.assertEqual(c.direction,"east")
b = game.if_empty(food,0)
self.assertEqual(b,False)
示例2: test_Darwin_9
# 需要導入模塊: from Darwin import Darwin [as 別名]
# 或者: from Darwin.Darwin import if_empty [as 別名]
def test_Darwin_9(self):
assert hasattr(Darwin, "play_round")
game = Darwin(5,5)
food = Species("food")
c = Creature(food)
space = Species(".")
game.place_creature(c,2,2,"east")
self.assertEqual(c.direction,"east")
b = game.if_empty(space,0)
self.assertEqual(b,True)