From 4d1d881c4de2ecc61cd011a1ee630bb6563735e2 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 19 Jul 2018 13:13:01 +0800 Subject: [PATCH] check if blind > self.stack --- holdem/player.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/holdem/player.py b/holdem/player.py index 36553c0..9f8cf04 100644 --- a/holdem/player.py +++ b/holdem/player.py @@ -74,14 +74,17 @@ def reset_hand(self): self.playing_hand = (self.stack != 0) def bet(self, bet_size): + # not for bigblind, smallblind # bet_size = min(player.stack, player_bet) + player.currentbet self.playedthisround = True if not bet_size: # for check return - self.stack -= (bet_size - self.currentbet) - self.currentbet = bet_size - if self.stack == 0: + actualbet = bet_size - self.currentbet + if self.stack <= actualbet: + actualbet = self.stack self.isallin = True + self.stack -= actualbet + self.currentbet += actualbet def refund(self, ammount): self.stack += ammount