Skip to content

Commit

Permalink
check if blind > self.stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Jul 19, 2018
1 parent 8f70790 commit 4d1d881
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions holdem/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4d1d881

Please sign in to comment.