From 39ad552cb5f48c288e1d7a62e80ceb180882eae0 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 30 Sep 2026 17:30:00 -0400 Subject: chore: remove dead casino code and fold duplicated menu/odds logic --- internal/game/render_craps.go | 50 ++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 15 deletions(-) (limited to 'internal/game/render_craps.go') diff --git a/internal/game/render_craps.go b/internal/game/render_craps.go index 2270659..d6db43f 100644 --- a/internal/game/render_craps.go +++ b/internal/game/render_craps.go @@ -39,10 +39,13 @@ type crapsCell struct { } type crapsCanvas struct{ cells [][]crapsCell } -func newCrapsCanvas(w, h int) *crapsCanvas { +// crapsCanvasWidth is the fixed felt width every craps render uses. +const crapsCanvasWidth = 77 + +func newCrapsCanvas(h int) *crapsCanvas { c := &crapsCanvas{cells: make([][]crapsCell, h)} for y := range c.cells { - c.cells[y] = make([]crapsCell, w) + c.cells[y] = make([]crapsCell, crapsCanvasWidth) } return c } @@ -136,10 +139,10 @@ func crapsDie(n int) string { return string([]rune{'⚀', '⚁', '⚂', '⚃', '⚄', '⚅'}[n-1]) } func renderCrapsTrackers(s *casino.CrapsSnapshot, mode string, unicode bool) string { - c := newCrapsCanvas(77, 7) - c.box(0, 0, 76, 3) - c.box(0, 3, 38, 6) - c.box(38, 3, 76, 6) + c := newCrapsCanvas(12) + c.box(0, 0, 76, 2) + c.box(0, 5, 38, 8) + c.box(38, 5, 76, 8) c.text(3, 1, "FIRE", crapsGold) for i, n := range []int{4, 5, 6, 8, 9, 10} { ink, mark := crapsMuted, " " @@ -148,9 +151,15 @@ func renderCrapsTrackers(s *casino.CrapsSnapshot, mode string, unicode bool) str } c.text(15+i*9, 1, fmt.Sprintf("[%2d%s]", n, mark), ink) } - c.center(1, 75, 2, "MADE POINTS 4: 24 to 1 5: 249 to 1 6: 999 to 1", crapsInk) - c.text(2, 4, "ALL SMALL", crapsGold) - c.text(40, 4, "TALL", crapsGold) + bounds := []int{0, 25, 50, 76} + for i, payout := range []string{"24:1", "249:1", "999:1"} { + lo, hi := bounds[i], bounds[i+1] + c.box(lo, 2, hi, 5) + c.center(lo+1, hi-1, 3, fmt.Sprintf("%d DISTINCT POINTS", i+4), crapsGold) + c.center(lo+1, hi-1, 4, payout, crapsInk) + } + c.text(2, 6, "ALL SMALL", crapsGold) + c.text(40, 6, "TALL", crapsGold) for i, n := range []int{2, 3, 4, 5, 6, 8, 9, 10, 11, 12} { x := 12 + i*5 if i >= 5 { @@ -160,14 +169,20 @@ func renderCrapsTrackers(s *casino.CrapsSnapshot, mode string, unicode bool) str if crapsHas(s.Seen, n) { ink, mark = crapsMarked, "*" } - c.text(x, 4, fmt.Sprintf("%2d%s ", n, mark), ink) + c.text(x, 6, fmt.Sprintf("%2d%s ", n, mark), ink) + } + c.center(1, 37, 7, "* = rolled", crapsMuted) + c.center(39, 75, 7, "* = rolled", crapsMuted) + for i, row := range [][2]string{{"SMALL", "34:1"}, {"ALL", "175:1"}, {"TALL", "34:1"}} { + lo, hi := bounds[i], bounds[i+1] + c.box(lo, 8, hi, 11) + c.center(lo+1, hi-1, 9, row[0], crapsGold) + c.center(lo+1, hi-1, 10, row[1], crapsInk) } - c.center(1, 37, 5, "SMALL 34:1 | ALL 175:1", crapsInk) - c.center(39, 75, 5, "TALL 34:1 | * = rolled", crapsInk) return c.render(mode, unicode) } func renderCrapsFelt(s *casino.CrapsSnapshot, mode string, unicode bool) string { - c := newCrapsCanvas(77, 26) + c := newCrapsCanvas(26) c.box(0, 0, 14, 6) c.center(1, 13, 4, "DON'T COME", crapsInk) c.center(1, 13, 5, "BAR 12", crapsMuted) @@ -318,6 +333,9 @@ func renderCrapsSnapshot(s *casino.CrapsSnapshot, mode string, unicode bool, sty if s.Point != 0 { point = fmt.Sprintf("POINT %d", s.Point) } + if s.Variant == "simplified" { + point = "ONE ROLL" + } variant := s.Variant if variant == "" { variant = "bank" @@ -327,12 +345,14 @@ func renderCrapsSnapshot(s *casino.CrapsSnapshot, mode string, unicode bool, sty out.WriteString(renderCrapsTrackers(s, mode, unicode)) out.WriteByte('\n') out.WriteString(renderCrapsFelt(s, mode, unicode)) + } else if variant == "simplified" { + out.WriteString(renderSimplifiedCrapsFelt(mode, unicode)) } else { height := 7 - if variant == "simplified" || variant == "high_point" || variant == "die_rich" { + if variant == "high_point" || variant == "die_rich" { height = 6 } - c := newCrapsCanvas(77, height) + c := newCrapsCanvas(height) c.box(0, 0, 76, height-1) c.center(1, 75, 1, "HOUSE EDITION — table rules for payouts", crapsGold) switch variant { -- cgit v1.2.3