Пример #1
0
    def test_is_action_valid(self):
        """

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

        print(TexasHoldemAction.AllIn)
        action = TexasHoldemAction("Allin_1000")
        print(action.key)
Пример #2
0
    def test_available_actions(self):
        """

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

        actions = env.available_actions()
        self.assertTrue("Allin_1000" in actions)

        env.__public_state_history__[-1].__raise_account__ = 200
        actions = TexasHoldemEnv.available_actions()
        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]
Пример #3
0
    def test_available_actions(self):
        """

        """
        env = TexasHoldemEnv()
        infos, public_history, persons_history, private_history, action_history = env.init(
        )

        pu = public_history[-1]
        pr = private_history[-1]
        pe = persons_history[pu.turn][-1]

        while len(pr.all_used_cards) < (len(persons_history) - 1) * 2 + 5:
            action = list(pe.available_actions.values())[-1]

            if len(pr.all_used_cards) == (len(persons_history) - 1) * 2 + 4:
                xx = 0
                pass

            env.forward(action)

            pu = public_history[-1]
            pr = private_history[-1]
            pe = persons_history[pu.turn][-1]

        actions = env.available_actions()
        self.assertTrue("Allin_1000" in actions)

        env.__public_state_history__[-1].__raise_account__ = 200
        actions = env.available_actions()
        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]