当前位置: 首页>>代码示例>>Python>>正文


Python world_map.WorldMap类代码示例

本文整理汇总了Python中simulation.world_map.WorldMap的典型用法代码示例。如果您正苦于以下问题:Python WorldMap类的具体用法?Python WorldMap怎么用?Python WorldMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WorldMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_not_enough_score_space

 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)
开发者ID:observer61,项目名称:aimmo,代码行数:7,代码来源:test_world_map.py

示例2: test_not_enough_pickup_space

 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)
开发者ID:joshuablake,项目名称:aimmo,代码行数:7,代码来源:test_world_map.py

示例3: test_pickup_spawn_chance

 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)
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:7,代码来源:test_world_map.py

示例4: test_get_x_off_map

 def test_get_x_off_map(self):
     map = WorldMap(self._generate_grid())
     for y in (0, 1):
         with self.assertRaises(ValueError):
             map.get_cell(Location(-1, y))
         with self.assertRaises(ValueError):
             map.get_cell(Location(2, y))
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:7,代码来源:test_world_map.py

示例5: test_not_enough_pickup_space

 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)
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:7,代码来源:test_world_map.py

示例6: test_scores_removed

 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)
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:7,代码来源:test_world_map.py

示例7: test_scores_removed

 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)
开发者ID:joshuablake,项目名称:aimmo,代码行数:7,代码来源:test_world_map.py

示例8: test_no_score_cells_generated_if_no_suitable_cells

 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)
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:7,代码来源:test_world_map.py

示例9: test_get_y_off_map

 def test_get_y_off_map(self):
     map = WorldMap(self._generate_grid())
     for x in (0, 1):
         with self.assertRaises(ValueError):
             map.get_cell(Location(x, -1))
         with self.assertRaises(ValueError):
             map.get_cell(Location(x, 2))
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:7,代码来源:test_world_map.py

示例10: test_all_cells

 def test_all_cells(self):
     map = WorldMap(self._generate_grid())
     cell_names = [c.name for c in map.all_cells()]
     self.assertIn('A', cell_names)
     self.assertIn('B', cell_names)
     self.assertIn('C', cell_names)
     self.assertIn('D', cell_names)
     self.assertEqual(len(cell_names), 4)
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:8,代码来源:test_world_map.py

示例11: test_pickups_not_added_when_at_target

 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())
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:8,代码来源:test_world_map.py

示例12: test_pickups_not_added_when_at_target

 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())
开发者ID:joshuablake,项目名称:aimmo,代码行数:8,代码来源:test_world_map.py

示例13: test_score_despawn_chance

 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)
开发者ID:joshuablake,项目名称:aimmo,代码行数:8,代码来源:test_world_map.py

示例14: test_grid_expand

    def test_grid_expand(self):
        world_map.TARGET_NUM_CELLS_PER_AVATAR = 5
        map = WorldMap(self._generate_grid())
        map.reconstruct_interactive_state(1)
        self.assertGridSize(map, 3)

        map.reconstruct_interactive_state(2)
        self.assertGridSize(map, 4)
开发者ID:joshuablake,项目名称:aimmo,代码行数:8,代码来源:test_world_map.py

示例15: test_scores_not_added_when_at_target

 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())
开发者ID:ChrisMukherjee,项目名称:aimmo,代码行数:8,代码来源:test_world_map.py


注:本文中的simulation.world_map.WorldMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。