def test_interal_game_reset_functionality(): p1 = Player("bob") p2 = Player("sharon") game = Game(deck=StandardDeck(), agents=[p1, p2], n_rounds=2, cards_per_player=10) game.play_round() assert game.turn == 11 game.play_round() assert game.turn == 21 game.reset_game() assert game.turn == 0 assert len(p1.hand) == 10 assert len(p2.hand) == 10 # def test_simulated_games_should_be_distinct(): # p1 = Player("bob") # p2 = Player("sharon") # game = Game(deck_constructor=StandardDeck, agents=[p1, p2], n_rounds=2, cards_per_player=10) # result1 = game.simulate_game() # result2 = game.simulate_game() # result3 = game.simulate_game() # result4 = game.simulate_game() # result5 = game.simulate_game() # print(result5[['action', 'player', 'round', 'reward']]) # assert result5['bob'] < 100 # assert result5['sharon'] < 100
class Environment(): def __init__(self, name, opponents): self.name = name self.user_agent = "foo" self.game = Game(agents=[self.user_agent] + opponents) def reset(self): self.game.reset_game() return self.game.get_observation("env-player") def action_space(self): return self.game.get_action_space("env-player") def step(self, action):