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