diff options
Diffstat (limited to 'internal/casino/blackjack_wagers.go')
| -rw-r--r-- | internal/casino/blackjack_wagers.go | 41 |
1 files changed, 41 insertions, 0 deletions
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 <amount>, 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 +} |
