Exemplo n.º 1
0
 def test_raises_eq(self):
     r1 = GameAction(GameAction.RAISE, 10)
     r2 = GameAction(GameAction.RAISE, 30)
     self.assertNotEqual(r1, r2)
     self.assertTrue(r1.is_raise())
     self.assertEquals("Raise", r1.name())
     self.assertEquals("<GameAction type=R, amount=10>", repr(r1))
Exemplo n.º 2
0
    def __do_action(self, action):
        current_better = self.current_better
        br = self.br
        if action is None:
            action = GameAction(GameAction.FOLD)

        to_call = br.to_call(current_better)

        if action.is_fold():
            br.post_fold(current_better)
        elif action.is_raise():
            if action.amount < br.minimum_raise:
                action.amount = br.minimum_raise
            action.amount += to_call
            self.__check_bet(br, current_better, action)
        elif action.is_call():
            action.amount = to_call
            self.__check_bet(br, current_better, action)
        elif action.is_check():
            br.post_bet(current_better, 0)

        self.parent.say_action(current_better, action)
        self.log.action(current_better, action)
Exemplo n.º 3
0
    def __do_action(self, action):
        current_better = self.current_better
        br = self.br
        if action is None:
            action = GameAction(GameAction.FOLD)

        to_call = br.to_call(current_better)

        if action.is_fold():
            br.post_fold(current_better)
        elif action.is_raise():
            if action.amount < br.minimum_raise:
                action.amount = br.minimum_raise
            action.amount += to_call
            self.__check_bet(br, current_better, action)
        elif action.is_call():
            action.amount = to_call
            self.__check_bet(br, current_better, action)
        elif action.is_check():
            br.post_bet(current_better, 0)

        self.parent.say_action(current_better, action)
        self.log.action(current_better, action)