本文整理汇总了Python中simulation.world_map.WorldMap.pickup_cells方法的典型用法代码示例。如果您正苦于以下问题:Python WorldMap.pickup_cells方法的具体用法?Python WorldMap.pickup_cells怎么用?Python WorldMap.pickup_cells使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulation.world_map.WorldMap
的用法示例。
在下文中一共展示了WorldMap.pickup_cells方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pickups_not_added_when_at_target
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
def test_pickups_not_added_when_at_target(self):
world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 1
grid = self._generate_grid()
grid[Location(0, 1)].pickup = MockPickup()
map = WorldMap(grid)
map.update(1)
self.assertEqual(len(list(map.pickup_cells())), 1)
self.assertIn(grid[Location(0, 1)], map.pickup_cells())
示例2: test_pickups_added
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
def test_pickups_added(self):
world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 1
world_map.PICKUP_SPAWN_CHANCE = 1
map = WorldMap(self._generate_grid())
map.update(1)
self.assertEqual(len(list(map.pickup_cells())), 1)
map.update(2)
self.assertEqual(len(list(map.pickup_cells())), 2)
示例3: test_not_enough_pickup_space
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
def test_not_enough_pickup_space(self):
world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 1
grid = self._generate_grid(1, 1)
grid[Location(0, 0)].generates_score = True
map = WorldMap(grid)
map.update(1)
self.assertEqual(len(list(map.pickup_cells())), 0)
示例4: test_pickup_spawn_chance
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
def test_pickup_spawn_chance(self):
world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 5
world_map.PICKUP_SPAWN_CHANCE = 0
grid = self._generate_grid()
map = WorldMap(grid)
map.update(1)
self.assertEqual(len(list(map.pickup_cells())), 0)
示例5: test_not_enough_pickup_space
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
def test_not_enough_pickup_space(self):
world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 1
grid = self._generate_grid(1)
grid = [[MockCell(avatar='avatar')]]
map = WorldMap(grid)
map.reconstruct_interactive_state(1)
self.assertEqual(len(list(map.pickup_cells())), 0)
示例6: test_pickups_not_added_when_at_target
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
def test_pickups_not_added_when_at_target(self):
world_map.TARGET_NUM_PICKUPS_PER_AVATAR = 1
grid = self._generate_grid()
grid[0][1].pickup = True
map = WorldMap(grid)
map.reconstruct_interactive_state(1)
self.assertEqual(len(list(map.pickup_cells())), 1)
self.assertIn(grid[0][1], map.pickup_cells())
示例7: test_pickup_cells
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
def test_pickup_cells(self):
pickup_cell1 = MockCell(pickup=MockPickup())
pickup_cell2 = MockCell(pickup=MockPickup())
no_pickup_cell = MockCell()
grid = self._grid_from_list([[pickup_cell1, no_pickup_cell], [no_pickup_cell, pickup_cell2]])
map = WorldMap(grid)
cells = list(map.pickup_cells())
self.assertIn(pickup_cell1, cells)
self.assertIn(pickup_cell2, cells)
self.assertEqual(len(cells), 2, "Non-pickup cells present")
示例8: test_pickup_cells
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
def test_pickup_cells(self):
pickup_cell1 = MockCell(pickup='pickup1')
pickup_cell2 = MockCell(pickup='pickup')
no_pickup_cell = MockCell()
grid = [[pickup_cell1, no_pickup_cell], [no_pickup_cell, pickup_cell2]]
map = WorldMap(grid)
cells = list(map.pickup_cells())
self.assertIn(pickup_cell1, cells)
self.assertIn(pickup_cell2, cells)
self.assertEqual(len(cells), 2, "Non-pickup cells present")
示例9: test_pickup_cells
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import pickup_cells [as 别名]
def test_pickup_cells(self):
cells = self._generate_cells()
cells[0]['pickup'] = {'health_restored': 5}
cells[8]['pickup'] = {'health_restored': 2}
map = WorldMap(cells)
self.assertLocationsEqual(map.pickup_cells(), (Location(-1, -1), Location(1, 1)))