def test_actions_eq(self): call = GameAction(GameAction.CALL) self.assertTrue(call.is_call()) self.assertEqual("Call", call.name()) check = GameAction(GameAction.CHECK) self.assertTrue(check.is_check()) self.assertEquals("<GameAction type=C, amount=0>", repr(check)) self.assertNotEqual(call, check)
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)