dkforest

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

commit b8507e2a947006f1dfac561d368486ee14fabc22
parent 3112abc875dcb26b2d8629c0601995324902cb67
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed, 20 Dec 2023 22:45:02 -0500

keep game cards in log

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

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -1221,6 +1221,7 @@ func dealerThread(g *PokerGame) { // Show cards showCards(g, seats) + g.newLogEvent(g.ongoing.gameStr()) END: @@ -1244,6 +1245,20 @@ END: g.isGameStarted.Store(false) } +func (g *ongoingGame) gameStr() string { + out := fmt.Sprintf("%s", g.communityCards) + for _, p := range g.players { + if !p.folded.Load() { + out += fmt.Sprintf(" | @%s", p.username) + p.cards.RWith(func(pCards *[]playerCard) { + out += " " + (*pCards)[0].name + out += " " + (*pCards)[1].name + }) + } + } + return out +} + func applySmallBlindBet(g *PokerGame, bigBlindBet database.PokerChip, sbIdx int) { applyBlindBet(g, sbIdx, bigBlindBet/2, "small blind") }