当前位置: 首页>>代码示例>>Python>>正文


Python Darwin.place_creature方法代码示例

本文整理汇总了Python中Darwin.Darwin.place_creature方法的典型用法代码示例。如果您正苦于以下问题:Python Darwin.place_creature方法的具体用法?Python Darwin.place_creature怎么用?Python Darwin.place_creature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Darwin.Darwin的用法示例。


在下文中一共展示了Darwin.place_creature方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_game_1

# 需要导入模块: from Darwin import Darwin [as 别名]
# 或者: from Darwin.Darwin import place_creature [as 别名]
 def test_game_1(self):
     game = Darwin(4,4)
     food = Species("food")
     food.add_instruction("right")
     food.add_instruction("go 0")
     f1 = Creature(food)
     game.place_creature(f1,2,2, "north")
     self.assertNotEqual(game.run(4),[])
开发者ID:ibrahimnagib,项目名称:Darwins-World,代码行数:10,代码来源:TestDarwin.py

示例2: test_Darwin_11

# 需要导入模块: from Darwin import Darwin [as 别名]
# 或者: from Darwin.Darwin import place_creature [as 别名]
 def test_Darwin_11(self):
     assert hasattr(Darwin, "infect")
     game = Darwin(5,5)
     rover = Species("rover")
     c = Creature(rover)
     space = Species(".")
     game.place_creature(c,2,2,"west")
     self.assertEqual(c.direction,"west") 
     v = game.if_enemy(space,False) 
开发者ID:ibrahimnagib,项目名称:Darwins-World,代码行数:11,代码来源:TestDarwin.py

示例3: test_Darwin_7

# 需要导入模块: from Darwin import Darwin [as 别名]
# 或者: from Darwin.Darwin import place_creature [as 别名]
 def test_Darwin_7(self):
     assert hasattr(Darwin, "show_board")
     game = Darwin(5,5)
     trap = Species("trap")
     c = Creature(trap)
     game.place_creature(c,2,2,"north")
     self.assertEqual(c.direction,"north")
     game.left(0,0)
     self.assertEqual(c.direction,"west")
开发者ID:ibrahimnagib,项目名称:Darwins-World,代码行数:11,代码来源:TestDarwin.py

示例4: test_Darwin_6

# 需要导入模块: from Darwin import Darwin [as 别名]
# 或者: from Darwin.Darwin import place_creature [as 别名]
 def test_Darwin_6(self):
     # assert hasattr(Darwin, "place_creature")
     game = Darwin(5,5)
     food = Species("food")
     b = Creature(food)
     game.place_creature(b,2,2,"west")
     self.assertEqual(b.direction,"west")
     game.left(0,0)
     self.assertEqual(b.direction,"south")
开发者ID:ibrahimnagib,项目名称:Darwins-World,代码行数:11,代码来源:TestDarwin.py

示例5: test_Darwin_5

# 需要导入模块: from Darwin import Darwin [as 别名]
# 或者: from Darwin.Darwin import place_creature [as 别名]
 def test_Darwin_5(self):
     assert hasattr(Darwin, "hop")
     game = Darwin(6,6)
     rover = Species("rover")
     c = Creature(rover)
     game.place_creature(c,2,3,"east")
     self.assertEqual(c.direction,"east")
     game.right(0,0)
     self.assertEqual(c.direction,"south")
开发者ID:ibrahimnagib,项目名称:Darwins-World,代码行数:11,代码来源:TestDarwin.py

示例6: test_Darwin_12

# 需要导入模块: from Darwin import Darwin [as 别名]
# 或者: from Darwin.Darwin import place_creature [as 别名]
 def test_Darwin_12(self):
     assert hasattr(Darwin, "play_round")
     game = Darwin(5,5)
     food = Species("food")
     c = Creature(food)
     space = Species(".")
     game.place_creature(c,2,2,"south")
     self.assertEqual(c.direction,"south") 
     v = game.if_enemy(c.species,0) 
     self.assertEqual(v, False)
开发者ID:ibrahimnagib,项目名称:Darwins-World,代码行数:12,代码来源:TestDarwin.py

示例7: test_Darwin_10

# 需要导入模块: from Darwin import Darwin [as 别名]
# 或者: from Darwin.Darwin import place_creature [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)
开发者ID:ibrahimnagib,项目名称:Darwins-World,代码行数:12,代码来源:TestDarwin.py

示例8: test_Darwin_9

# 需要导入模块: from Darwin import Darwin [as 别名]
# 或者: from Darwin.Darwin import place_creature [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)       
开发者ID:ibrahimnagib,项目名称:Darwins-World,代码行数:12,代码来源:TestDarwin.py

示例9: test_Darwin_8

# 需要导入模块: from Darwin import Darwin [as 别名]
# 或者: from Darwin.Darwin import place_creature [as 别名]
 def test_Darwin_8(self):
     assert hasattr(Darwin, "if_empty")
     game = Darwin(7,7)
     food = Species("food")
     c = Creature(food)
     game.place_creature(c,4,4,"north")
     self.assertEqual(c.direction,"north")
     game.right(0,0)
     self.assertEqual(c.direction,"east")
     game.right(0,0)
     self.assertEqual(c.direction,"south")
     game.right(0,0)
     self.assertEqual(c.direction,"west")
开发者ID:ibrahimnagib,项目名称:Darwins-World,代码行数:15,代码来源:TestDarwin.py

示例10: test_Darwin_4

# 需要导入模块: from Darwin import Darwin [as 别名]
# 或者: from Darwin.Darwin import place_creature [as 别名]
 def test_Darwin_4(self):
     assert hasattr(Darwin, "right")
     game = Darwin(5,5)
     food = Species("food")
     c = Creature(food)
     game.place_creature(c,2,2,"east")
     self.assertEqual(c.direction,"east")
     game.left(0,0)
     self.assertEqual(c.direction,"north")
     game.left(0,0)
     self.assertEqual(c.direction,"west")
     game.left(0,0)
     self.assertEqual(c.direction,"south")
     game.left(0,0)
     self.assertEqual(c.direction,"east")
开发者ID:ibrahimnagib,项目名称:Darwins-World,代码行数:17,代码来源:TestDarwin.py


注:本文中的Darwin.Darwin.place_creature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。