aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/table_hints.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-30 20:50:45 -0400
committerhistoria <[not public]>2026-09-30 20:50:45 -0400
commite3ff06fc79682673194c8913f0feb9e90920e7d0 (patch)
tree86e25670b5bd02d9868130afcc7a69ec1b7b9ed1 /internal/casino/table_hints.go
parenta5b9c1052c4640ba519e608e0c97e603ce6aa5ef (diff)
downloadthehouseoficarus-e3ff06fc79682673194c8913f0feb9e90920e7d0.tar.gz
feat: look, rules, and list commands updated for casino games
Diffstat (limited to 'internal/casino/table_hints.go')
-rw-r--r--internal/casino/table_hints.go86
1 files changed, 86 insertions, 0 deletions
diff --git a/internal/casino/table_hints.go b/internal/casino/table_hints.go
new file mode 100644
index 0000000..00eea53
--- /dev/null
+++ b/internal/casino/table_hints.go
@@ -0,0 +1,86 @@
+package casino
+
+import "fmt"
+
+// Per-game live-hint registration: every game answers the same two views
+// through the tableGame interface — its full hint list (finished with the
+// shared "rules" and "list" entries) and its wager table — so the shared
+// table controls never need a per-game switch. All entries are seated only;
+// a standing player is not told how to bet at a game they have not joined.
+
+func (t *crapsTable) wagers(name string) []WagerRow { return t.wagerRows(name) }
+func (t *crapsTable) hints(name string) []MenuCommand { return t.commands(name) }
+
+func (t *rouletteTable) wagers(name string) []WagerRow { return t.wagerRows() }
+func (t *rouletteTable) hints(name string) []MenuCommand {
+ p := t.players.get(name)
+ if p == nil {
+ return nil
+ }
+ commands := []MenuCommand{}
+ if t.phase != phasePlaying && !p.HasBet {
+ commands = append(commands, MenuCommand{Command: "bet <amount> on <target>", Desc: "Place one wager; targets: list"})
+ if p.lastBet > 0 {
+ commands = append(commands, MenuCommand{Command: "bet / rebet", Desc: "Repeat your previous wager"})
+ }
+ }
+ commands = append(commands, MenuCommand{Command: "sitout / stop", Desc: "Sit out / leave when your wager settles"})
+ commands = append(commands, MenuCommand{Command: "table", Desc: "View the layout"})
+ return withTableHints(commands, t.wagerRows())
+}
+
+// blackjackHintsIdle are the shared controls for a bettor with no structured
+// menu right now (an in-flight round has no betting menu to reuse).
+func blackjackHintsIdle() []MenuCommand {
+ return []MenuCommand{
+ {Command: "table", Desc: "View the table"},
+ {Command: "sitout", Desc: "Sit out after this round"},
+ {Command: "stop", Desc: "Leave after this round"},
+ }
+}
+
+func (t *blackjackTable) wagers(name string) []WagerRow { return t.wagerRows(name) }
+func (t *blackjackTable) hints(name string) []MenuCommand {
+ if t.players.get(name) == nil {
+ return nil
+ }
+ var commands []MenuCommand
+ if menu := t.menuEvent(name); menu.Menu != nil && len(menu.Menu.Commands) > 0 {
+ // The real menu is authoritative: betting, insurance, turn actions
+ // or the committed-wager view, exactly as the round allows.
+ commands = menu.Menu.Commands
+ } else {
+ commands = blackjackHintsIdle()
+ }
+ return withTableHints(commands, t.wagerRows(name))
+}
+
+func (t *baccaratTable) wagers(name string) []WagerRow { return t.wagerRows() }
+func (t *baccaratTable) hints(name string) []MenuCommand {
+ if t.players.get(name) == nil {
+ return nil
+ }
+ return withTableHints(baccaratHintCommands(t, name), t.wagerRows())
+}
+
+// baccaratHintCommands mirrors menuEvent's branches without re-deriving the
+// menu view: a committed wager never advertises another bet.
+func baccaratHintCommands(t *baccaratTable, name string) []MenuCommand {
+ p := t.players.get(name)
+ if p != nil && p.HasBet {
+ return []MenuCommand{
+ {Command: "stop", Desc: "Leave; during a round, leave afterward"},
+ {Command: "table / sitout", Desc: "Check the table / skip betting until you rejoin"},
+ }
+ }
+ commands := []MenuCommand{}
+ if p != nil && p.lastBet > 0 {
+ commands = append(commands, MenuCommand{Command: "bet", Desc: fmt.Sprintf("Repeat %d on %s (also: rebet)", p.lastBet, p.lastSpot)}, MenuCommand{Command: "bet <amount>", Desc: "Change amount; keep " + p.lastSpot})
+ }
+ return append(commands,
+ MenuCommand{Command: fmt.Sprintf("bet %d banker", t.Config.MinBet), Desc: "Choose banker (b), player (p), or tie (t)"},
+ MenuCommand{Command: "bet <amount> on <target>", Desc: "One wager per round; targets: list"},
+ MenuCommand{Command: "stop", Desc: "Leave; during a round, leave afterward"},
+ MenuCommand{Command: "table / sitout", Desc: "Check the table / skip betting until you rejoin"},
+ )
+}