Skip to content

Commit

Permalink
Bug fix: returnChips could empty stack in some situations
Browse files Browse the repository at this point in the history
  • Loading branch information
alexclewontin committed Aug 2, 2020
1 parent 35d6859 commit 2dfd3fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ func Deal(g *Game, pn uint, data uint) error {
g.communityCards[i] = 0
}

g.pots = []Pot{}

for !g.players[g.dealerNum].Ready {
g.dealerNum = (g.dealerNum + 1) % uint(len(g.players))
}
Expand Down
2 changes: 1 addition & 1 deletion player.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (p *player) putInChips(amt uint) {
func (p *player) returnChips(amt uint) {
if p.TotalBet > amt {
p.TotalBet -= amt
p.Stack -= amt
p.Stack += amt
} else {
p.Stack += p.TotalBet
p.TotalBet = 0
Expand Down

0 comments on commit 2dfd3fe

Please sign in to comment.