Exemple #1
0
def run(options):
  random.seed(options.random_seed)
  world_map = terrain.TerrainMap(terrain.read_map(options.map), options.map)
  robots = robot_module.load_robots(options.robots, world_map)
  history = play_history.PlayHistory()
  master.Master(options, robots, world_map, history).run()
  return history, world_map
Exemple #2
0
def run(options):
  random.seed(options.random_seed)
  world_map = terrain.TerrainMap(terrain.read_map(options.map), options.map)
  robots = robot_module.load_robots(options.robots, world_map)
  history = play_history.PlayHistory()
  master.Master(options, robots, world_map, history).run()
  return history, world_map
Exemple #3
0
  def test_load(self):
    robots = robot_module.load_robots(['Target', 'Target'], self._world_map)
    self.assertEqual(robots[0].name, 'Target(#0)')
    self.assertEqual(robots[1].name, 'Target(#1)')
    self.assertNotEqual(robots[0], robots[1])

    # Ensure maps in robots are equivalent to world map, but are not the
    # same instance (to prevent map rewriting)
    self.assertEquals(robots[0]._map, self._world_map)
    self.assertFalse(robots[0]._map is self._world_map)
    self.assertEquals(robots[1]._map, self._world_map)
    self.assertFalse(robots[1]._map is self._world_map)
Exemple #4
0
    def test_load(self):
        robots = robot_module.load_robots(['Target', 'Target'],
                                          self._world_map)
        self.assertEqual(robots[0].name, 'Target(#0)')
        self.assertEqual(robots[1].name, 'Target(#1)')
        self.assertNotEqual(robots[0], robots[1])

        # Ensure maps in robots are equivalent to world map, but are not the
        # same instance (to prevent map rewriting)
        self.assertEquals(robots[0]._map, self._world_map)
        self.assertFalse(robots[0]._map is self._world_map)
        self.assertEquals(robots[1]._map, self._world_map)
        self.assertFalse(robots[1]._map is self._world_map)