本文整理汇总了Python中simulation.world_map.WorldMap.score_cells方法的典型用法代码示例。如果您正苦于以下问题:Python WorldMap.score_cells方法的具体用法?Python WorldMap.score_cells怎么用?Python WorldMap.score_cells使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulation.world_map.WorldMap
的用法示例。
在下文中一共展示了WorldMap.score_cells方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_scores_not_added_when_at_target
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import score_cells [as 别名]
def test_scores_not_added_when_at_target(self):
world_map.TARGET_NUM_SCORE_LOCATIONS_PER_AVATAR = 1
grid = self._generate_grid()
grid[Location(0, 1)].generates_score = True
map = WorldMap(grid)
map.update(1)
self.assertEqual(len(list(map.score_cells())), 1)
self.assertIn(grid[Location(0, 1)], map.score_cells())
示例2: test_score_despawn_chance
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import score_cells [as 别名]
def test_score_despawn_chance(self):
world_map.TARGET_NUM_SCORE_LOCATIONS_PER_AVATAR = 0
grid = self._generate_grid()
grid[Location(0, 1)].generates_score = True
map = WorldMap(grid)
map.update(1)
self.assertIn(grid[Location(0, 1)], map.score_cells())
self.assertEqual(len(list(map.score_cells())), 1)
示例3: test_scores_added
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import score_cells [as 别名]
def test_scores_added(self):
world_map.TARGET_NUM_SCORE_LOCATIONS_PER_AVATAR = 1
map = WorldMap(self._generate_grid())
map.update(1)
self.assertEqual(len(list(map.score_cells())), 1)
map.update(2)
self.assertEqual(len(list(map.score_cells())), 2)
示例4: test_no_score_cells_generated_if_no_suitable_cells
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import score_cells [as 别名]
def test_no_score_cells_generated_if_no_suitable_cells(self):
world_map.TARGET_NUM_SCORE_LOCATIONS_PER_AVATAR = 1
grid = self._generate_grid(1, 1)
grid[Location(0, 0)].avatar = 'avatar'
map = WorldMap(grid)
map.update(1)
self.assertEqual(len(list(map.score_cells())), 0)
示例5: test_not_enough_score_space
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import score_cells [as 别名]
def test_not_enough_score_space(self):
world_map.TARGET_NUM_SCORE_LOCATIONS_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.score_cells())), 0)
示例6: test_scores_removed
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import score_cells [as 别名]
def test_scores_removed(self):
world_map.SCORE_DESPAWN_CHANCE = 1
grid = self._generate_grid()
grid[Location(0, 1)].generates_score = True
map = WorldMap(grid)
map.update(1)
self.assertEqual(len(list(map.score_cells())), 0)
示例7: test_scores_removed
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import score_cells [as 别名]
def test_scores_removed(self):
world_map.SCORE_DESPAWN_CHANCE = 1
grid = self._generate_grid()
grid[0][1].generates_score = True
map = WorldMap(grid)
map.reconstruct_interactive_state(1)
self.assertEqual(len(list(map.score_cells())), 0)
示例8: test_scores_not_added_when_at_target
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import score_cells [as 别名]
def test_scores_not_added_when_at_target(self):
world_map.TARGET_NUM_SCORE_LOCATIONS_PER_AVATAR = 1
grid = self._generate_grid()
grid[0][1].generates_score = True
map = WorldMap(grid)
map.reconstruct_interactive_state(1)
self.assertEqual(len(list(map.score_cells())), 1)
self.assertIn(grid[0][1], map.score_cells())
示例9: test_score_despawn_chance
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import score_cells [as 别名]
def test_score_despawn_chance(self):
world_map.TARGET_NUM_SCORE_LOCATIONS_PER_AVATAR = 0
grid = self._generate_grid()
grid[0][1].generates_score = True
map = WorldMap(grid)
map.reconstruct_interactive_state(1)
self.assertIn(grid[0][1], map.score_cells())
self.assertEqual(len(list(map.score_cells())), 1)
示例10: test_score_cells
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import score_cells [as 别名]
def test_score_cells(self):
score_cell1 = MockCell(generates_score=True)
score_cell2 = MockCell(generates_score=True)
no_score_cell = MockCell()
grid = self._grid_from_list([[score_cell1, no_score_cell], [no_score_cell, score_cell2]])
map = WorldMap(grid)
cells = list(map.score_cells())
self.assertIn(score_cell1, cells)
self.assertIn(score_cell2, cells)
self.assertEqual(len(cells), 2, "Non-scoring cells present")
示例11: test_score_cells
# 需要导入模块: from simulation.world_map import WorldMap [as 别名]
# 或者: from simulation.world_map.WorldMap import score_cells [as 别名]
def test_score_cells(self):
cells = self._generate_cells()
cells[0]['generates_score'] = True
cells[5]['generates_score'] = True
map = WorldMap(cells)
self.assertLocationsEqual(map.score_cells(), (Location(-1, -1), Location(0, 1)))