From 6232d41e5639f9c38e47b2bb65266e343ca26e8f Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sat, 3 Oct 2026 02:16:00 -0400 Subject: feat: add casino_hints option and standardize casino command syntax --- internal/game/casino_house_edge.go | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'internal/game/casino_house_edge.go') diff --git a/internal/game/casino_house_edge.go b/internal/game/casino_house_edge.go index 1abbcac..de0036b 100644 --- a/internal/game/casino_house_edge.go +++ b/internal/game/casino_house_edge.go @@ -76,8 +76,8 @@ func (g *Game) casinoListRows(sess *net.Session, t *casino.Table, wagers []casin // Different target returns need distinct rows, not a list of unlabeled RTPs. for _, part := range row.edge.Parts { entry := row - if strings.Contains(wager.Bet, "") { - entry.bet = strings.ReplaceAll(wager.Bet, "", part.Label) + if bet, ok := expandBetNumber(wager.Bet, part.Label); ok { + entry.bet = bet } else if part.Label != "" { // The label refines the shared win text (hop's doubles), so append // it: the base phrase stays "Next roll is a/b (doubles)". @@ -90,6 +90,24 @@ func (g *Game) casinoListRows(sess *net.Session, t *casino.Table, wagers []casin return rows } +// expandBetNumber replaces the standalone number variable N in a grouped +// wager row ("buy N", "odds dont N") with one concrete number. It reports +// false when the row has no N token, leaving the label to refine the win text. +func expandBetNumber(bet, number string) (string, bool) { + fields := strings.Fields(bet) + found := false + for i, f := range fields { + if f == "N" { + fields[i] = number + found = true + } + } + if !found { + return bet, false + } + return strings.Join(fields, " "), true +} + // Explicit list-only presentation. Wrap plain cells before applying color and // handing them to the existing ANSI-aware table renderer; never truncate rules. // The table stands alone: list names no heading and no balance above it, and @@ -174,7 +192,11 @@ func (g *Game) showCasinoListTable(sess *net.Session, betHeader string, rows []c category = "casino_action" } physical[i] = parts[line] - if category != "" { + switch category { + case "command": + physical[i] = g.colorizeCommand(sess, physical[i]) + case "": + default: physical[i] = g.colorize(sess, category, physical[i]) } } -- cgit v1.2.3