本文整理汇总了Python中simulation.world_map.WorldMap.potential_spawn_locations方法的典型用法代码示例。如果您正苦于以下问题:Python WorldMap.potential_spawn_locations方法的具体用法?Python WorldMap.potential_spawn_locations怎么用?Python WorldMap.potential_spawn_locations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulation.world_map.WorldMap
的用法示例。
在下文中一共展示了WorldMap.potential_spawn_locations方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_potential_spawns
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import potential_spawn_locations [as 别名]
def test_potential_spawns(self):
spawnable1 = MockCell()
spawnable2 = MockCell()
score_cell = MockCell(generates_score=True)
unhabitable = MockCell(habitable=False)
filled = MockCell(avatar='avatar')
grid = self._grid_from_list([[spawnable1, score_cell, unhabitable], [unhabitable, spawnable2, filled]])
map = WorldMap(grid)
cells = list(map.potential_spawn_locations())
self.assertIn(spawnable1, cells)
self.assertIn(spawnable2, cells)
self.assertNotIn(score_cell, cells, "Score cells should not be spawns")
self.assertNotIn(unhabitable, cells, "Unhabitable cells should not be spawns")
self.assertNotIn(filled, cells, "Cells with avatars should not be spawns")
self.assertEqual(len(cells), 2)