Exemplo n.º 1
0
 def _compete(self, match_id, home, away):
     game = Game(match_id,
                 home_team=deepcopy(home.team),
                 away_team=deepcopy(away.team),
                 home_agent=home.bot,
                 away_agent=away.bot,
                 config=self.config)
     game.config.fast_mode = True
     game.config.competition_mode = True
     game.init()
     game.step()
     assert game.state.game_over
     return GameResult(game)
Exemplo n.º 2
0
def run_game(nbr_of_games, enable_forward_model):
    config = ffai.load_config("gym-11")
    config.fast_mode = True
    ruleset = ffai.load_rule_set(config.ruleset)
    home = ffai.load_team_by_filename("human", ruleset)
    away = ffai.load_team_by_filename("human", ruleset)
    away_agent = Agent("Human 1", human=True, agent_id=1)
    home_agent = Agent("Human 2", human=True, agent_id=2)

    seed = 0
    random_agent = ffai.make_bot('random')
    random_agent.rnd = np.random.RandomState(seed)

    for _ in range(nbr_of_games):
        game = Game(seed, home, away, home_agent, away_agent, config)
        game.init()
        if enable_forward_model:
            game.enable_forward_model()
        while not game.state.game_over:
            game.step(random_agent.act(game))