aboutsummaryrefslogtreecommitdiff
path: root/internal/game/render_craps.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-30 16:16:17 -0400
committerhistoria <[not public]>2026-09-30 16:16:17 -0400
commita4c09c2d38d1f3bc1d3ad4bdb0234bdea7c37e73 (patch)
tree00c9567e620f331a59dd44f1f1fa779ecd94a845 /internal/game/render_craps.go
parent724079f8de1ae69965c6267dca3d7fc3cc86afa2 (diff)
downloadthehouseoficarus-a4c09c2d38d1f3bc1d3ad4bdb0234bdea7c37e73.tar.gz
feat: additional craps variants added, standardizard casino command hints
Diffstat (limited to 'internal/game/render_craps.go')
-rw-r--r--internal/game/render_craps.go55
1 files changed, 45 insertions, 10 deletions
diff --git a/internal/game/render_craps.go b/internal/game/render_craps.go
index 9f73b20..2270659 100644
--- a/internal/game/render_craps.go
+++ b/internal/game/render_craps.go
@@ -264,7 +264,7 @@ func renderCrapsFelt(s *casino.CrapsSnapshot, mode string, unicode bool) string
return c.render(mode, unicode)
}
func renderCrapsDice(dice [2]int, mode string, unicode bool, style string) string {
- if dice[0] < 1 || dice[0] > 6 || dice[1] < 1 || dice[1] > 6 {
+ if dice[0] < 1 || dice[0] > 6 || dice[1] < 0 || dice[1] > 6 {
return ""
}
patterns := [][3]string{{}, {" ", " o ", " "}, {"o ", " ", " o"}, {"o ", " o ", " o"}, {"o o", " ", "o o"}, {"o o", " o ", "o o"}, {"o o", "o o", "o o"}}
@@ -280,6 +280,9 @@ func renderCrapsDice(dice [2]int, mode string, unicode bool, style string) strin
for row := 0; row < 5; row++ {
out.WriteString(" ")
for i, n := range dice {
+ if n == 0 {
+ continue
+ }
line := top
if row == 4 {
line = bottom
@@ -315,21 +318,51 @@ func renderCrapsSnapshot(s *casino.CrapsSnapshot, mode string, unicode bool, sty
if s.Point != 0 {
point = fmt.Sprintf("POINT %d", s.Point)
}
- out.WriteString("\n" + title(" BANK CRAPS") + subtle(" / "+point) + "\n")
- out.WriteString(renderCrapsTrackers(s, mode, unicode))
- out.WriteByte('\n')
- out.WriteString(renderCrapsFelt(s, mode, unicode))
+ variant := s.Variant
+ if variant == "" {
+ variant = "bank"
+ }
+ out.WriteString("\n" + title(" "+strings.ToUpper(strings.ReplaceAll(variant, "_", " "))+" CRAPS") + subtle(" / "+point) + "\n")
+ if variant == "bank" || variant == "diceless" {
+ out.WriteString(renderCrapsTrackers(s, mode, unicode))
+ out.WriteByte('\n')
+ out.WriteString(renderCrapsFelt(s, mode, unicode))
+ } else {
+ height := 7
+ if variant == "simplified" || variant == "high_point" || variant == "die_rich" {
+ height = 6
+ }
+ c := newCrapsCanvas(77, height)
+ c.box(0, 0, 76, height-1)
+ c.center(1, 75, 1, "HOUSE EDITION — table rules for payouts", crapsGold)
+ switch variant {
+ case "crapless":
+ c.center(1, 75, 3, "POINTS: 2 3 4 5 6 8 9 10 11 12 | PASS / COME / ODDS", crapsInk)
+ c.center(1, 75, 4, "PLACE / BUY / LAY / FIELD / HARD / HOP / PROPOSITIONS", crapsInk)
+ c.center(1, 75, 5, "NO DON'T BETS OR BONUSES", crapsMuted)
+ case "new_york":
+ c.center(1, 75, 3, "PASS / DON'T PASS (BAR 12) / ODDS / BUY / LAY", crapsInk)
+ c.center(1, 75, 4, "BUY / LAY: 4 5 6 8 9 10 | 5% WIN-ONLY COMMISSION", crapsMuted)
+ default:
+ c.center(1, 75, 3, "PASS ONLY | WINS PAY 1:1 | NO ODDS OR BONUSES", crapsInk)
+ }
+ out.WriteString(c.render(mode, unicode))
+ }
out.WriteByte('\n')
- out.WriteString(renderCrapsDice(s.Dice, mode, unicode, style))
+ if variant == "diceless" {
+ out.WriteString(renderCrapsCards(s.Dice, mode, unicode, style))
+ } else {
+ out.WriteString(renderCrapsDice(s.Dice, mode, unicode, style))
+ }
if len(s.Queue) > 0 {
out.WriteString(title(" Shooter ") + subtle(s.Queue[0]) + "\n")
if len(s.Queue) > 1 {
out.WriteString(subtle(" On deck "+strings.Join(s.Queue[1:], " > ")) + "\n")
}
}
- hint := "Place a bet, then roll when ready."
+ hint := ""
if s.Phase != "waiting" && s.Phase != "" {
- hint = "Your pace. Roll when ready."
+ hint = ""
if s.ShootIn > 0 {
hint = fmt.Sprintf("Bets open. Shooter ready in %ds.", s.ShootIn)
} else if s.DealerIn > 0 {
@@ -337,8 +370,10 @@ func renderCrapsSnapshot(s *casino.CrapsSnapshot, mode string, unicode bool, sty
}
}
if s.AutoRoll {
- hint = fmt.Sprintf("AUTOROLL / Next roll in %ds / stop for manual play", s.AutoIn)
+ hint = fmt.Sprintf("AUTOROLL / Shooter's next roll in %ds", s.AutoIn)
+ }
+ if hint != "" {
+ out.WriteString(subtle(" "+hint) + "\n")
}
- out.WriteString(subtle(" "+hint) + "\n")
return out.String()
}