diff options
Diffstat (limited to 'internal/game')
| -rw-r--r-- | internal/game/casino.go | 6 | ||||
| -rw-r--r-- | internal/game/casino_commands_test.go | 24 | ||||
| -rw-r--r-- | internal/game/render_craps.go | 15 | ||||
| -rw-r--r-- | internal/game/render_craps_paytable.go | 15 |
4 files changed, 34 insertions, 26 deletions
diff --git a/internal/game/casino.go b/internal/game/casino.go index 517cde0..744eac6 100644 --- a/internal/game/casino.go +++ b/internal/game/casino.go @@ -639,12 +639,12 @@ func (g *Game) casinoBoardReminder(sess *net.Session, category string, menu *cas } // composeTableThenReminder joins a menu header, the board graphic, and the -// wager reminder. The board snapshot already leads with a blank line, so only -// the reminder needs an extra gap before it. +// wager reminder. The board snapshot already leads with a blank line, and the +// reminder keeps exactly one blank line below the board's last visible row. func composeTableThenReminder(header, table, reminder string) string { out := header if table != "" { - out += "\n" + table + out += "\n" + strings.TrimRight(table, "\n") } if reminder != "" { out += "\n\n" + reminder diff --git a/internal/game/casino_commands_test.go b/internal/game/casino_commands_test.go index 0ae1593..5e05d4e 100644 --- a/internal/game/casino_commands_test.go +++ b/internal/game/casino_commands_test.go @@ -102,25 +102,27 @@ func TestCasinoCompactHintsUseOnlyAvailableCommands(t *testing.T) { } func TestSimplifiedFeltSpacingAndNoIdlePrompt(t *testing.T) { text := renderCrapsSnapshot(&casino.CrapsSnapshot{Variant: "simplified"}, "none", true) - for _, want := range []string{"DICE TOTAL", "NET PROFIT", "3 or 4", "1:1 (even money)", "10 or 11", "LOSE STAKE", "ONE ROLL", "stake back"} { + for _, want := range []string{"SIMPLIFIED CRAPS", "DICE TOTAL", "PAYOUT", "3 or 4", "1:1", "10 or 11", "LOSE STAKE"} { if !strings.Contains(text, want) { t.Fatalf("missing %q: %s", want, text) } } - if strings.Contains(text, "WINS PAY 1:1") || strings.Contains(text, "COME-OUT") { - t.Fatal("stale simplified rules", text) + for _, stale := range []string{"even money", "NET PROFIT", "stake back", "PASS ONLY", "ONE ROLL", "COME-OUT"} { + if strings.Contains(text, stale) { + t.Fatalf("stale simplified rules %q", stale) + } } if strings.Contains(text, "Place a bet, then roll when ready.") { t.Fatal(text) } - rows := strings.Split(text, "\n") - for i, row := range rows { - if strings.Contains(row, "PASS ONLY") { - if i+1 >= len(rows) || strings.Trim(rows[i+1], "│ ") != "" || !strings.HasPrefix(rows[i+2], "└") { - t.Fatal("expected exactly one blank footer row", text) - } - return + rows := strings.Split(strings.TrimSuffix(text, "\n"), "\n") + for i := 0; i < len(rows)-1; i++ { + if strings.TrimSpace(rows[i]) == "" && strings.TrimSpace(rows[i+1]) == "" { + t.Fatalf("consecutive blank lines at %d: %q", i, text) } } - t.Fatal("missing pass label") + // The paytable ends at its own bottom border: no footer block remains. + if strings.Count(text, "─") == 0 || strings.Contains(text, "NO POINT, ODDS") { + t.Fatalf("stale footer: %q", text) + } } diff --git a/internal/game/render_craps.go b/internal/game/render_craps.go index d6db43f..64c910e 100644 --- a/internal/game/render_craps.go +++ b/internal/game/render_craps.go @@ -334,13 +334,18 @@ func renderCrapsSnapshot(s *casino.CrapsSnapshot, mode string, unicode bool, sty point = fmt.Sprintf("POINT %d", s.Point) } if s.Variant == "simplified" { - point = "ONE ROLL" + // The title alone says it: simplified craps has no point phase. + point = "" } variant := s.Variant if variant == "" { variant = "bank" } - out.WriteString("\n" + title(" "+strings.ToUpper(strings.ReplaceAll(variant, "_", " "))+" CRAPS") + subtle(" / "+point) + "\n") + out.WriteString("\n" + title(" "+strings.ToUpper(strings.ReplaceAll(variant, "_", " "))+" CRAPS")) + if point != "" { + out.WriteString(subtle(" / "+point)) + } + out.WriteString("\n") if variant == "bank" || variant == "diceless" { out.WriteString(renderCrapsTrackers(s, mode, unicode)) out.WriteByte('\n') @@ -383,7 +388,11 @@ func renderCrapsSnapshot(s *casino.CrapsSnapshot, mode string, unicode bool, sty hint := "" if s.Phase != "waiting" && s.Phase != "" { hint = "" - if s.ShootIn > 0 { + if s.Variant == "simplified" { + if s.ShootIn > 0 { + hint = fmt.Sprintf("The dice roll in %ds.", s.ShootIn) + } + } else if s.ShootIn > 0 { hint = fmt.Sprintf("Bets open. Shooter ready in %ds.", s.ShootIn) } else if s.DealerIn > 0 { hint = fmt.Sprintf("Shooter ready. Dealer rolls in %ds; bets still open.", s.DealerIn) diff --git a/internal/game/render_craps_paytable.go b/internal/game/render_craps_paytable.go index 346ed83..5acf92a 100644 --- a/internal/game/render_craps_paytable.go +++ b/internal/game/render_craps_paytable.go @@ -1,19 +1,19 @@ package game -// Keep each outcome beside its net profit instead of packing a series of -// total:odds pairs into a sentence. The footer distinguishes profit from the -// returned stake and retains one blank felt row below the command summary. +// Keep each outcome beside its payout instead of packing a series of +// total:odds pairs into a sentence. One blank felt row sits below the +// command summary. func renderSimplifiedCrapsFelt(mode string, unicode bool) string { - c := newCrapsCanvas(13) + c := newCrapsCanvas(9) for _, x := range []int{0, 38} { c.box(x, 0, x+38, 2) c.box(x, 2, x+38, 8) } c.center(1, 37, 1, "DICE TOTAL", crapsGold) - c.center(39, 75, 1, "NET PROFIT", crapsGold) + c.center(39, 75, 1, "PAYOUT", crapsGold) rows := [][2]string{ {"2", "3:1"}, - {"3 or 4", "1:1 (even money)"}, + {"3 or 4", "1:1"}, {"10 or 11", "2:1"}, {"12", "5:1"}, {"5, 6, 7, 8 or 9", "LOSE STAKE"}, @@ -22,8 +22,5 @@ func renderSimplifiedCrapsFelt(mode string, unicode bool) string { c.center(1, 37, i+3, row[0], crapsInk) c.center(39, 75, i+3, row[1], crapsInk) } - c.box(0, 8, 76, 12) - c.center(1, 75, 9, "Winners also receive their original stake back.", crapsMuted) - c.center(1, 75, 10, "PASS ONLY | ONE ROLL | NO POINT, ODDS OR SIDE BETS", crapsGold) return c.render(mode, unicode) } |
