本文整理汇总了Python中simulation.world_map.WorldMap.get_random_spawn_location方法的典型用法代码示例。如果您正苦于以下问题:Python WorldMap.get_random_spawn_location方法的具体用法?Python WorldMap.get_random_spawn_location怎么用?Python WorldMap.get_random_spawn_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulation.world_map.WorldMap
的用法示例。
在下文中一共展示了WorldMap.get_random_spawn_location方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_random_spawn_location
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import get_random_spawn_location [as 别名]
def test_random_spawn_location(self):
cell = MockCell()
map = WorldMap({Location(0, 0): cell})
self.assertEqual(map.get_random_spawn_location(), cell.location)
示例2: test_random_spawn_location_with_no_candidates
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import get_random_spawn_location [as 别名]
def test_random_spawn_location_with_no_candidates(self):
grid = self._generate_grid(1, 1)
map = WorldMap(grid)
grid[Location(0, 0)].avatar = True
with self.assertRaises(IndexError):
map.get_random_spawn_location()
示例3: test_random_spawn_location_with_no_candidates
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import get_random_spawn_location [as 别名]
def test_random_spawn_location_with_no_candidates(self):
cell = MockCell()
map = WorldMap([[cell]])
cell.avatar = 'true'
with self.assertRaises(IndexError):
map.get_random_spawn_location()