dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit a5338f1a63624c1c2f552d29466a758ad934f1f1
parent 59258e16897f9d4fbc507d0203a83b564145b4e4
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sun, 17 Dec 2023 02:42:07 -0500

cleanup

Diffstat:
Mpkg/web/handlers/poker/poker.go | 21+++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -832,15 +832,10 @@ RoundIsSettled: time.Sleep(time.Second) - // Calculate what is the max gain all-in players can make mainPot := g.Ongoing.getMainPot() - for _, p := range newlyAllInPlayers { - maxGain := mainPot - for _, op := range g.Ongoing.Players { - maxGain += utils.MinInt(op.GetBet(), p.GetBet()) - } - p.AllInMaxGain = maxGain - } + + // Calculate what is the max gain all-in players can make + computeAllInMaxGain(g, newlyAllInPlayers, mainPot) // When only one player remain alive (everyone else fold) // We refund the "uncalled bet" so that it does not go in the main pot and does not get raked. @@ -934,6 +929,16 @@ func dealPlayersCards(g *PokerGame, roomTopic string, seats []Seat, idx *int) { } } +func computeAllInMaxGain(g *PokerGame, newlyAllInPlayers []*PokerPlayer, mainPot database.PokerChip) { + for _, p := range newlyAllInPlayers { + maxGain := mainPot + for _, op := range g.Ongoing.Players { + maxGain += utils.MinInt(op.GetBet(), p.GetBet()) + } + p.AllInMaxGain = maxGain + } +} + func dealerThread(db *database.DkfDB, g *PokerGame, roomID RoomID) { roomTopic := roomID.Topic() roomLogsTopic := roomID.LogsTopic()