diff options
| author | historia <[not public]> | 2026-09-29 18:58:28 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-29 18:58:28 -0400 |
| commit | 624626b9a10ae47cf7d5f6e91765570ed759bd74 (patch) | |
| tree | 9812f5d254b7d9cfe1d2fcb6da53362e974541b0 /internal/game/render_casino_help.go | |
| parent | ff9002b96e35ad0808945e7c35791460c9ca8776 (diff) | |
| download | thehouseoficarus-624626b9a10ae47cf7d5f6e91765570ed759bd74.tar.gz | |
feat: better roulette racetrack graphics and payout table
Diffstat (limited to 'internal/game/render_casino_help.go')
| -rw-r--r-- | internal/game/render_casino_help.go | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/internal/game/render_casino_help.go b/internal/game/render_casino_help.go new file mode 100644 index 0000000..5a76ef0 --- /dev/null +++ b/internal/game/render_casino_help.go @@ -0,0 +1,85 @@ +package game + +import ( + "fmt" + "strings" + + "thehouseoficarus/internal/casino" + "thehouseoficarus/internal/net" + "thehouseoficarus/internal/ui" +) + +// casinoBetTable uses the shared ANSI-aware table renderer, rather than +// letting the session wrap a long, pipe-separated payout paragraph. +func (g *Game) casinoBetTable(sess *net.Session, title string, columns []string, rows [][]string) string { + t := ui.Table{Title: g.colorize(sess, "casino_action", title)} + for _, col := range columns { + t.Columns = append(t.Columns, g.colorize(sess, "casino_action", col)) + } + for _, row := range rows { + cells := append([]string(nil), row...) + for i, cell := range cells { + category := "casino_action" + if i == 0 { + category = "command" + } + if i == len(cells)-1 { + category = "casino_payout" + } + cells[i] = g.colorize(sess, category, cell) + } + t.Rows = append(t.Rows, cells) + } + unicode, width := true, 78 + if p := sess.Player; p != nil { + unicode = p.OptionBool("unicode") + if wrap := p.OptionInt("wrap_width"); wrap > 0 { + width = min(width, wrap) + } + } + return strings.Join(t.Render(unicode, width), "\n") +} + +// rouletteReminder is shown by table/table rules, not on ambient boards. +// Hit chances count equally likely pockets; all ratios are NET profit odds. +func (g *Game) rouletteReminder(sess *net.Session, cfg casino.TableConfig) string { + pockets, basketCount, basketOdds := 37, 4, "8:1" + if cfg.Roulette.DoubleZero { + pockets, basketCount, basketOdds = 38, 5, "6:1" + } + chance := func(n int) string { return fmt.Sprintf("%d/%d", n, pockets) } + rows := [][]string{ + {"Number", "17 (or 0)", chance(1), "35:1"}, + {"Split", "split 1 2", chance(2), "17:1"}, + {"Street", "street 1 2 3", chance(3), "11:1"}, + {"Trio", "trio 0 1 2", chance(3), "11:1"}, + {"Corner", "corner 1 2 4 5", chance(4), "8:1"}, + {"Six line", "line 1 2 3 4 5 6", chance(6), "5:1"}, + {"Dozen", "1to12/13to24/25to36", chance(12), "2:1"}, + {"Row", "row1/row2/row3", chance(12), "2:1"}, + {"Color", "red / black", chance(18), "1:1"}, + {"Parity", "odd / even", chance(18), "1:1"}, + {"Low / high", "low / high", chance(18), "1:1"}, + {"Basket", "basket", chance(basketCount), basketOdds}, + } + if cfg.Roulette.DoubleZero { + rows[0][1] = "17 (or 0, 00)" + } + blocks := []string{g.casinoBetTable(sess, "Roulette payouts", []string{"Bet", "Target / example", "Chance", "Profit"}, rows)} + if cfg.Roulette.Racetrack && !cfg.Roulette.DoubleZero { + blocks = append(blocks, g.casinoBetTable(sess, "Racetrack payouts", []string{"Target", "Chance", "Profit on total stake"}, [][]string{ + {"voisins", chance(17), "1:1; 0/2/3 pay 5:3"}, + {"tiers", chance(12), "2:1"}, + {"orphelins", chance(8), "13:5; 1/17 pay 31:5"}, + {"zero / jeu zero", chance(7), "7:2; 26 pays 8:1"}, + {"neighbors <n>", chance(9), "3:1"}, + })) + blocks = append(blocks, "Call bets split your total stake; fractional returns round down.\nUse help racetrack for the chip placements.") + } + blocks = append(blocks, + "Profit excludes your returned stake: 1:1 on 10 returns 20.\n"+ + "Low: 1-18; high: 19-36. Zero pockets lose outside bets.\n"+ + "Use bet <amount> on <target>, e.g. bet 10 on split 1 2.\n"+ + "Learn more: help roulette / help casino; table rules for this table.") + return strings.Join(blocks, "\n") +} |
