diff options
| author | historia <[not public]> | 2026-09-16 17:05:17 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-16 17:05:17 -0400 |
| commit | 1dad15698845d370e998f7cc5feb8aece3fab58f (patch) | |
| tree | 8d58058782de9f422573e1f8efd5d130ce7d1ce9 /internal/casino | |
| parent | a6cf03a6ae98e4fb675da25046d148e92bcf7206 (diff) | |
| download | thehouseoficarus-1dad15698845d370e998f7cc5feb8aece3fab58f.tar.gz | |
refactor: remove dead code, consolidate save/error handling, add lint gate
Diffstat (limited to 'internal/casino')
| -rw-r--r-- | internal/casino/blackjack.go | 2 | ||||
| -rw-r--r-- | internal/casino/credits_test.go | 2 | ||||
| -rw-r--r-- | internal/casino/machine.go | 6 |
3 files changed, 6 insertions, 4 deletions
diff --git a/internal/casino/blackjack.go b/internal/casino/blackjack.go index d3b26af..bc038c7 100644 --- a/internal/casino/blackjack.go +++ b/internal/casino/blackjack.go @@ -1,3 +1,5 @@ +// Package casino implements the in-game casino: chip/credit wallets, table +// games (blackjack, baccarat), slot machines, and their shared state machine. package casino import ( diff --git a/internal/casino/credits_test.go b/internal/casino/credits_test.go index 4094d72..cff19c9 100644 --- a/internal/casino/credits_test.go +++ b/internal/casino/credits_test.go @@ -55,7 +55,7 @@ func TestWalletErrorMessages(t *testing.T) { } func inf() float64 { - var max float64 = 1e308 + max := 1e308 return max * 10 } func nan() float64 { return inf() - inf() } diff --git a/internal/casino/machine.go b/internal/casino/machine.go index f156fe7..757588b 100644 --- a/internal/casino/machine.go +++ b/internal/casino/machine.go @@ -79,7 +79,7 @@ func (m *Machine) setBet(name string, amount int, wallet Wallet) []Event { if amount < m.Config.MinBet || amount > m.Config.MaxBet { return m.private(fmt.Sprintf("Slot machine bets must be %s.", betRangeText(m.Config.MinBet, m.Config.MaxBet))) } - return m.beginSpinLocked(name, amount, wallet, + return m.beginSpinLocked(amount, wallet, fmt.Sprintf("%s sets the bet to %d and pulls the lever.", name, amount), fmt.Sprintf("Bet set to %d. You pull the lever on the slots machine.", amount)) } @@ -99,12 +99,12 @@ func (m *Machine) start(name string, wallet Wallet) []Event { if m.bet <= 0 { return m.private("Set a wager first with 'bet <amount>'.") } - return m.beginSpinLocked(name, m.bet, wallet, + return m.beginSpinLocked(m.bet, wallet, fmt.Sprintf("%s pulls the lever on the slots machine.", name), "You pull the lever on the slots machine.") } -func (m *Machine) beginSpinLocked(name string, amount int, wallet Wallet, publicMessage, privateMessage string) []Event { +func (m *Machine) beginSpinLocked(amount int, wallet Wallet, publicMessage, privateMessage string) []Event { if _, err := wallet.Wager(amount); err != nil { return m.private(walletErrorMessage(err, "You don't have enough chips and credits for that bet.")) } |
