def _run_match(self, match_id, home_team, away_team, home_agent, away_agent): game = Game(match_id, home_team=deepcopy(home_team), away_team=deepcopy(away_team), home_agent=home_agent, away_agent=away_agent, config=self.config, record=self.record) game.config.fast_mode = True game.config.competition_mode = True print("Starting new match") try: with stopit.ThreadingTimeout(int( self.config.time_limits.game)) as to_ctx_mgr: game.init() if to_ctx_mgr.state != to_ctx_mgr.EXECUTED: print("Game timed out!") game.end_time = time.time() game.game_over = True game.disqualified_agent = game.actor return GameResult(game) except Exception as e: print( f"Game crashed by {game.actor.name if game.actor is not None else 'the framework'}: ", e) game.disqualified_agent = game.actor return GameResult(game, crashed=True) return GameResult(game)
def _run_match(self, match_id, home_team, away_team, home_agent, away_agent): game = Game(match_id, home_team=deepcopy(home_team), away_team=deepcopy(away_team), home_agent=home_agent, away_agent=away_agent, config=self.config) game.config.fast_mode = True game.config.competition_mode = True try: with self.time_limit(int(self.config.time_limits.game_time_limit)): game.init() except TimeoutException: print("Game timed out!") # Load from autosave #data_path = get_data_path(rel_path=f"auto/{game.game_id}.ffai") #game = pickle.load(open(data_path, "rb")) game.end_time = time.time() return GameResult(game) except Exception as e: print(f"Game crashed by {game.actor.name if game.actor is not None else 'the framework'}: ", e) return GameResult(game, crashed=True) return GameResult(game)