aboutsummaryrefslogtreecommitdiff
path: root/internal/game
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-03 01:46:58 -0400
committerhistoria <[not public]>2026-10-03 01:46:58 -0400
commitefccf58741ae43d9e891c6b743b146982b344ccf (patch)
tree505a068497c5531b91ac72da32db14145737e982 /internal/game
parent0ec8f3692960a064616e630c914058298b22897b (diff)
downloadthehouseoficarus-efccf58741ae43d9e891c6b743b146982b344ccf.tar.gz
fix: don't show roulette table after each bet
Diffstat (limited to 'internal/game')
-rw-r--r--internal/game/look_casino.go9
-rw-r--r--internal/game/look_casino_test.go13
-rw-r--r--internal/game/roulette_animation_test.go10
3 files changed, 23 insertions, 9 deletions
diff --git a/internal/game/look_casino.go b/internal/game/look_casino.go
index 1e91ced..8d2b5c3 100644
--- a/internal/game/look_casino.go
+++ b/internal/game/look_casino.go
@@ -66,7 +66,8 @@ func (g *Game) resolveRoomTable(sess *net.Session, target string, game casino.Ga
}
// renderCasinoTableDetails formats the details block and, for the felt games,
-// the per-table rule card. It never prints the craps or roulette board.
+// the per-table rule card. Roulette adds its live wheel; craps never prints a
+// board here.
func (g *Game) renderCasinoTableDetails(sess *net.Session, cfg casino.TableConfig, table *casino.Table) string {
seats := table.Seats()
seated := "no one"
@@ -82,6 +83,12 @@ func (g *Game) renderCasinoTableDetails(sess *net.Session, cfg casino.TableConfi
fmt.Sprintf(" Seated %s", seated),
}
switch cfg.Game {
+ case casino.GameRoulette:
+ // Look, like sitting down and the table command, shows the live
+ // wheel: tracker, racetrack, and betting layout.
+ if rendered := strings.TrimRight(g.renderCasinoSnapshot(sess, table.Board(sess.Player.Name)), "\n"); rendered != "" {
+ lines = append(lines, "", rendered)
+ }
case casino.GameBlackjack:
lines = append(lines, "", g.renderCasinoSnapshot(sess, &casino.BlackjackRulesView{Config: cfg}))
case casino.GameBaccarat:
diff --git a/internal/game/look_casino_test.go b/internal/game/look_casino_test.go
index 37205cd..651c74f 100644
--- a/internal/game/look_casino_test.go
+++ b/internal/game/look_casino_test.go
@@ -28,7 +28,7 @@ casino_tables:
envy: true
`
-func TestLookCasinoTableShowsDetailsWithoutInvariantBoards(t *testing.T) {
+func TestLookCasinoTableDetailsAndBoards(t *testing.T) {
g, sess, conn := casinoCrapsGame(t, lookCasinoRoom)
// Craps: details only. The graphical felt and the full rule dump are gone.
@@ -48,7 +48,7 @@ func TestLookCasinoTableShowsDetailsWithoutInvariantBoards(t *testing.T) {
}
}
- // Roulette: details only, no betting board or payout reference.
+ // Roulette: details plus the live wheel (tracker, layout, and history).
conn.data = nil
if !g.lookRouletteTable(sess, "roulette") {
t.Fatal("look roulette did not match")
@@ -57,10 +57,11 @@ func TestLookCasinoTableShowsDetailsWithoutInvariantBoards(t *testing.T) {
if !strings.Contains(text, "Roulette / Single zero") || !strings.Contains(text, "single-zero wheel") {
t.Fatalf("look roulette missing variant summary: %s", text)
}
- for _, gone := range []string{"Roulette payouts", "History: last"} {
- if strings.Contains(text, gone) {
- t.Fatalf("look roulette showed invariant board %q: %s", gone, text)
- }
+ if !strings.Contains(text, "History: last") {
+ t.Fatalf("look roulette missing the live board: %s", text)
+ }
+ if strings.Contains(text, "Roulette payouts") {
+ t.Fatalf("look roulette still dumps the payout reference: %s", text)
}
}
diff --git a/internal/game/roulette_animation_test.go b/internal/game/roulette_animation_test.go
index 96f14bb..d7f5626 100644
--- a/internal/game/roulette_animation_test.go
+++ b/internal/game/roulette_animation_test.go
@@ -46,8 +46,14 @@ func TestRouletteSpinOutputHasNoPromptOrBlankLines(t *testing.T) {
}
}
g.CasinoTick()
- if !strings.Contains(string(conn.data), "The ball lands in") || g.rouletteSpinning(sess) {
- t.Fatal("result did not end animation")
+ result := strings.ReplaceAll(string(conn.data), "\r\n", "\n")
+ if !strings.HasPrefix(result, "\nThe ball lands in") || g.rouletteSpinning(sess) {
+ t.Fatalf("result did not start on a blank line or end animation: %q", result)
+ }
+ // A resolved spin shows the result and the next-spin menu, but not the
+ // tracker, racetrack, and history again.
+ if strings.Contains(result, "History: last") {
+ t.Fatalf("settlement redrew the table board: %q", result)
}
sess.ClearPrompt()
conn.data = nil