From 0ec8f3692960a064616e630c914058298b22897b Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sat, 3 Oct 2026 01:38:58 -0400 Subject: feat: replaced roulette wheel graphic with line-by-line 'spin' --- internal/game/render_roulette.go | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'internal/game/render_roulette.go') diff --git a/internal/game/render_roulette.go b/internal/game/render_roulette.go index 218a91f..a0f1e04 100644 --- a/internal/game/render_roulette.go +++ b/internal/game/render_roulette.go @@ -16,8 +16,10 @@ import ( func renderRouletteSnapshot(s *casino.RouletteSnapshot, mode string, unicode bool, size int) string { switch s.Phase { case "playing": - // A blank line on either side keeps the wheel from crowding the prose. - return "\n" + renderRouletteWheel(s.Wheel, mode, unicode) + "\n" + if s.SpinFrame == 0 { + return "" + } + return renderRouletteSpin(s, mode, unicode) case "result": return "\n" + renderRouletteResult(s.Pockets, mode, unicode, size) + "\n" default: @@ -27,6 +29,27 @@ func renderRouletteSnapshot(s *casino.RouletteSnapshot, mode string, unicode boo } } +// A scrolling strip works in telnet scrollback without cursor-control escapes. +func renderRouletteSpin(s *casino.RouletteSnapshot, mode string, unicode bool) string { + var line strings.Builder + for i, pocket := range s.SpinPockets { + fg, _ := roulettePocketColor(pocket) + if fg == 0 { + fg = 8 // visible charcoal rather than invisible black on a dark terminal + } + text := "█" + if !unicode { + text = "#" + } + if i == s.BallPosition { + line.WriteString(roulettePaint(mode, ".", fg)) + } else { + line.WriteString(color.Render(mode, color.ColorSpec{Fg: fg, Bg: -1}, text)) + } + } + return line.String() +} + func rouletteInk(mode, text string) string { return color.Render(mode, color.ColorSpec{Fg: 15, Bg: -1}, text) } -- cgit v1.2.3