def test_game_complete(self): # [36, 45, 14, 5, 25, 20, 46, 48, 1, 46, 48, 13, 35, 45, 15, 18, 7, 2, # 30, 46, 47, 36, 43, 27, 5, 46, 48, 6, 2, 22, 46, 47, 35, 44, 29, 8, 46, # 48, 18, 21, 27, 26, 14, 11, 9, 46, 48, 17, 34, 43, 10, 1, 46, 47, 41, # 42, 24, 17, 46, 48, 0, 14, 3, 29, 46, 48, 41, 45, 19, 8, 30, 24, 20, # 16, 34, 46, 47, 39, 44, 16, 30, 18, 46, 48, 21, 46, 47, 39, 43, 24, # 26, 14, 22, 29, 6, 5, 7] game = TotalWattenGame(self.agent, self.agent) world = WorldTotalWatten() world.init_world_to_state(1, -1, 0, 0, [25, 9, 1, 32, 14], [5, 13, 7, 10, 20], [], 0, 0, 2, False, False, None, 16, 28, None, None) game.trueboard = world cur_player = game.get_cur_player() self.assertEqual(cur_player, 0) moves = game.get_valid_moves_no_zeros() self.assertEqual(moves, [0, 1]) self.assertEqual(game.make_move(0), (0.0, 1)) cur_player = game.get_cur_player() self.assertEqual(cur_player, 1) moves = game.get_valid_moves_no_zeros() self.assertEqual(moves, [0, 1])
def test_game_no_raise_player_A_starts(self): world = WorldTotalWatten() world.LOG.setLevel(DEBUG) world.init_world_to_state(-1, 1, 0, 0, [28, 29, 3, 15, 22], [19, 14, 7, 0, 11], [], 0, 0, 2, False, False, None, 18, 21, None, None) # [39, 44, 0, 46, 48, 3, 29, 46, 48, 14, 11, 15] world_copy = world.deepcopy() ######## MOVE ######## valid_moves = world.get_valid_moves() outcome, next_player = world.act(0, self.agent) # rank outcome, next_player = world.act(0, self.agent) # suit outcome, next_player = world.act(0, self.agent) # card outcome, next_player = world.act(1, self.agent) # raise outcome, next_player = world.act(3, self.agent) # accepted raise outcome, next_player = world.act(0, self.agent) # card -- outcome, next_player = world.act(1, self.agent) # raise outcome, next_player = world.act(3, self.agent) # accepted raise outcome, next_player = world.act(0, self.agent) # card -- outcome, next_player = world.act(0, self.agent) # card outcome, next_player = world.act(0, self.agent) # card outcome, next_player = world.act(0, self.agent) # card world.get_valid_moves()
def test_clone(self): game = TotalWattenGame(self.agent, self.agent) world = WorldTotalWatten() world.init_world_to_state(1, -1, 0, 0, [25, 9, 1, 32, 14], [5, 13, 7, 10, 20], [], 0, 0, 2, False, False, None, 16, 28, None, None) game.trueboard = world clone_game = game.clone() obs_game = game.get_observation(game.get_cur_player()) obs_clone_game = clone_game.get_observation(clone_game.get_cur_player()) obs_str = game.get_observation_str(obs_game) clone_obs_str = clone_game.get_observation_str(obs_clone_game) self.assertEqual(obs_str, clone_obs_str)