Esempio n. 1
0
    def step(self, obs):
        super(ReinforcementMarineAgent, self).step(obs)
        observations = Observations(obs)
        if observations.first():
            self.commander = QLearningCommander(self.name())
        elif observations.last():
            game_results = GameResultsTable(self.name())
            game_info = FinishedGameInformationDetails(self.steps, "unknown")
            game_results.append(observations.reward(),
                                observations.score_cumulative(), game_info)

        return self.commander.order(observations,
                                    self.steps).execute(observations)
Esempio n. 2
0
 def step(self, obs):
     super(BuildOrderAgent, self).step(obs)
     observations = Observations(obs)
     if observations.first():
         base_location = Location(observations)
         self.commander = GameCommander(base_location)
     elif observations.last():
         game_results = GameResultsTable(self.name())
         game_info = FinishedGameInformationDetails(self.steps, "unknown")
         game_results.append(observations.reward(),
                             observations.score_cumulative(), game_info)
     if self.debug:
         time.sleep(0.5)
     return self.commander.order(observations,
                                 self.steps).execute(observations)
Esempio n. 3
0
 def step(self, obs):
     super(HybridAttackReinforcementAgent, self).step(obs)
     observations = Observations(obs)
     if observations.first():
         base_location = Location(observations)
         self.enemy_detector = EnemyDetector()
         self.commander = HybridGameCommander(base_location, self.name(),
                                              self.enemy_detector)
     elif observations.last():
         game_results = GameResultsTable(self.name())
         game_info = FinishedGameInformationDetails(
             self.steps, self.enemy_detector.race())
         game_results.append(observations.reward(),
                             observations.score_cumulative(), game_info)
     return self.commander.order(observations,
                                 self.steps).execute(observations)