From e3ff06fc79682673194c8913f0feb9e90920e7d0 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 30 Sep 2026 20:50:45 -0400 Subject: feat: look, rules, and list commands updated for casino games --- internal/casino/blackjack_wagers.go | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 internal/casino/blackjack_wagers.go (limited to 'internal/casino/blackjack_wagers.go') diff --git a/internal/casino/blackjack_wagers.go b/internal/casino/blackjack_wagers.go new file mode 100644 index 0000000..23afac8 --- /dev/null +++ b/internal/casino/blackjack_wagers.go @@ -0,0 +1,41 @@ +package casino + +import "fmt" + +// Blackjack's only standing wager is bet , so outside the hand's +// decision points its wager list is empty (which also suppresses the "list" +// hint). During the insurance window and the player's own turn, the extra +// wagers and wagers-that-return-money get listed: insurance, decline, +// double, split and surrender — the same facts their own hints carry. +func (t *blackjackTable) wagerRows(name string) []WagerRow { + p := t.players.get(name) + if p == nil { + return nil + } + if t.phase == blackjackInsurance && p.HasBet && !p.declinedInsurance && p.insurance == 0 && len(p.hands) > 0 { + return []WagerRow{ + {"insurance", fmt.Sprintf("%g:1", t.Rules.InsurancePayout), fmt.Sprintf("Covers dealer blackjack; the stake costs %d", p.hands[0].bet/2)}, + {"decline", "", "Continue without insurance (also the timeout default)"}, + } + } + if t.phase == blackjackPlaying && t.activeName() == name && t.activeHand < len(p.hands) { + hand := p.hands[t.activeHand] + var rows []WagerRow + for _, action := range t.availableActions(p, hand) { + switch action { + case "hit": + rows = append(rows, WagerRow{"hit", "", "Take another card"}) + case "stand": + rows = append(rows, WagerRow{"stand", "", "Keep your total"}) + case "double": + rows = append(rows, WagerRow{"double", "1:1 on the added stake", fmt.Sprintf("Wager %d more, take exactly one card, stand", hand.bet)}) + case "split": + rows = append(rows, WagerRow{"split", "1:1 on the added stake", fmt.Sprintf("Wager %d more; play the pair as two hands", hand.bet)}) + case "surrender": + rows = append(rows, WagerRow{"surrender", "half returned", "Give up the original two-card hand"}) + } + } + return rows + } + return nil +} -- cgit v1.2.3