Ejemplo n.º 1
0
 def test_init_game(self):
     game = Game()
     state, player_id = game.init_game()
     test_id = game.get_player_id()
     self.assertEqual(test_id, player_id)
     self.assertIn('call', state['legal_actions'])
     self.assertIn('raise', state['legal_actions'])
     self.assertIn('fold', state['legal_actions'])
Ejemplo n.º 2
0
 def test_step_back(self):
     game = Game(allow_step_back=True)
     game.init_game()
     self.assertEqual(game.step_back(), False)
     index = 0
     previous = None
     while not game.is_over():
         index += 1
         legal_actions = game.get_legal_actions()
         if index == 2:
             result = game.step_back()
             now = game.get_player_id()
             if result:
                 self.assertEqual(previous, now)
             else:
                 self.assertEqual(len(game.history), 0)
             break
         previous = game.get_player_id()
         action = np.random.choice(legal_actions)
         game.step(action)