Example #1
0
    def test_available_actions(self):
        """

        """
        env = TexasHoldemEnv()
        env.init()

        actions = TexasHoldemEnv.available_actions(
            env.public_state, env.person_states[env.public_state.turn])
        self.assertTrue("Allin_1000" in actions)

        env.public_state.raise_account = 200
        actions = TexasHoldemEnv.available_actions(
            env.public_state, env.person_states[env.public_state.turn])
        self.assertTrue("Call_10" in actions)
        self.assertTrue("Raise_210" in actions)
        self.assertTrue("Raise_410" in actions)
        self.assertTrue("Raise_410" in actions)
        self.assertTrue("Raise_810" in actions)
        self.assertTrue("Allin_1000" in actions)
        for key in actions:
            act = actions[key]
            self.assertTrue(
                TexasHoldemEnv.is_action_valid(
                    act, env.public_state,
                    env.person_states[env.public_state.turn]))
Example #2
0
    def test_is_action_valid(self):
        """

        """
        env = TexasHoldemEnv()
        env.init()


        print (TexasHoldemAction.AllIn)
        action = TexasHoldemAction("Allin_1000")
        print (action.key)
        self.assertTrue(env.is_action_valid(action, env.public_state, env.person_states[env.public_state.turn]))