Ejemplo n.º 1
0
 def test_step_back(self):
     game = Game(allow_step_back=True)
     state, player_id = game.init_game()
     action = np.random.choice(game.get_legal_actions(state))
     game.step(action)
     game.step_back()
     self.assertEqual(game.round.current_player, player_id)
     self.assertEqual(len(game.history), 0)
     success = game.step_back()
     self.assertEqual(success, False)
Ejemplo n.º 2
0
 def test_step(self):
     game = Game()
     state, _ = game.init_game()
     action = np.random.choice(game.get_legal_actions(state))
     state, next_player_id = game.step(action)
     current = game.round.current_player
     self.assertLessEqual(len(state['current_hand']), 14)
     self.assertEqual(next_player_id, current)
Ejemplo n.º 3
0
 def test_get_payoffs(self):
     game = Game()
     state, _ = game.init_game()
     while not game.is_over():
         actions = game.get_legal_actions(state)
         action = np.random.choice(actions)
         state, _ = game.step(action)
         total_cards = len(state['current_hand'])
         self.assertLessEqual(total_cards, 14)
     win = game.is_over()
     self.assertEqual(win, True)