Beispiel #1
0
              1, func.function,
              'A camera move to center the idle worker is expected.')
          continue

        self.assertEqual(func.function, executed.function)
        print('Parsed and executed funcs: ', func, executed)
        # TODO(petkoig): Check whether we want the reported unit selection
        # TODO(petkoig): to match the original or current observation.
        for i, arg in enumerate(func.arguments):
          for j, value in enumerate(arg):
            self.assertEqual(value, executed.arguments[i][j])

      controller.step()

    return observations

  def test_replay_observations_match(self):
    config = Config()

    with GameController(config) as game_controller:
      game_controller.create_game()
      replay_data, observations = self._get_replay_data(
          game_controller.controller, config)

      game_controller.start_replay(replay_data)
      self._process_replay(game_controller.controller, observations, config)


if __name__ == '__main__':
  basetest.main()
Beispiel #2
0
    self.assertLessEqual(agent.episodes, agent.reward)
    self.assertEqual(agent.steps, self.steps)

  def test_collect_mineral_shards(self):
    with sc2_env.SC2Env(
        "CollectMineralShards",
        step_mul=self.step_mul,
        game_steps_per_episode=self.steps * self.step_mul) as env:
      agent = scripted_agent.CollectMineralShards()
      run_loop.run_loop([agent], env, self.steps)

    # Get some points
    self.assertLessEqual(agent.episodes, agent.reward)
    self.assertEqual(agent.steps, self.steps)

  def test_defeat_roaches(self):
    with sc2_env.SC2Env(
        "DefeatRoaches",
        step_mul=self.step_mul,
        game_steps_per_episode=self.steps * self.step_mul) as env:
      agent = scripted_agent.DefeatRoaches()
      run_loop.run_loop([agent], env, self.steps)

    # Get some points
    self.assertLessEqual(agent.episodes, agent.reward)
    self.assertEqual(agent.steps, self.steps)


if __name__ == "__main__":
  basetest.main()