dkforest

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

commit cc5b9df548560b05cdd8054724f0fad6a7562c27
parent e6590d8a203d60f5fbfe2fc5e30fcbe021d73497
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu,  7 Dec 2023 23:55:38 -0500

cleanup

Diffstat:
Mpkg/web/handlers/poker/poker.go | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -810,17 +810,18 @@ func processPot(winners []GameResult, nbPlayers, mainPot int) (res []PlayerGain) if mainPot == 0 { break } + handStr := poker.RankString(group.HandScore) isDone = true if len(group.Players) == 1 && group.Players[0].Cash > 0 { // Only 1 player win and is not all-in player := group.Players[0] - res = append(res, PlayerGain{player, mainPot, groupIdx, poker.RankString(group.HandScore)}) + res = append(res, PlayerGain{player, mainPot, groupIdx, handStr}) } else if len(group.Players) == 1 && group.Players[0].Cash == 0 { // Only 1 player win but is all-in player := group.Players[0] maxGain := player.RoundTotalBet * nbPlayers piece := utils.MinInt(maxGain, mainPot) - res = append(res, PlayerGain{player, piece, groupIdx, poker.RankString(group.HandScore)}) + res = append(res, PlayerGain{player, piece, groupIdx, handStr}) mainPot -= piece isDone = false } else if len(group.Players) > 1 { @@ -833,7 +834,7 @@ func processPot(winners []GameResult, nbPlayers, mainPot int) (res []PlayerGain) allInCount++ maxGain := p.RoundTotalBet * nbPlayers piece := utils.MinInt(maxGain, expectedSplit) - res = append(res, PlayerGain{p, piece, groupIdx, poker.RankString(group.HandScore)}) + res = append(res, PlayerGain{p, piece, groupIdx, handStr}) mainPot -= piece if nbPlayersInGroup-allInCount > 0 { expectedSplit = mainPot / (nbPlayersInGroup - allInCount) @@ -849,7 +850,7 @@ func processPot(winners []GameResult, nbPlayers, mainPot int) (res []PlayerGain) piece := mainPot / (nbPlayersInGroup - allInCount) // TODO: fix this for _, p := range group.Players { if p.Cash > 0 { - res = append(res, PlayerGain{p, piece, groupIdx, poker.RankString(group.HandScore)}) + res = append(res, PlayerGain{p, piece, groupIdx, handStr}) } } }