aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/types.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-05 16:31:22 -0400
committerhistoria <[not public]>2026-09-05 16:31:22 -0400
commitf4ea40c4b3589104dfaced3481ba19c5735889ae (patch)
tree66ead13206e52a65e64d6ba5d1576b63954682e9 /internal/casino/types.go
parent9a716a7d2ce514f452b425caedc1a9a15cde09f0 (diff)
downloadthehouseoficarus-main.tar.gz
fix: max bet no longer listed numerically, non-bettors can leave mid-roundHEADmain
Diffstat (limited to 'internal/casino/types.go')
-rw-r--r--internal/casino/types.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/internal/casino/types.go b/internal/casino/types.go
index 52c4bfa..4d5159a 100644
--- a/internal/casino/types.go
+++ b/internal/casino/types.go
@@ -1,5 +1,19 @@
package casino
+import "fmt"
+
+// maxBetUnlimited is the MaxBet sentinel meaning "no wager cap".
+const maxBetUnlimited = int(^uint(0) >> 1)
+
+// betRangeText describes the accepted wager range; the unlimited sentinel is
+// rendered as "no maximum" instead of a machine-sized integer.
+func betRangeText(minBet, maxBet int) string {
+ if maxBet == maxBetUnlimited {
+ return fmt.Sprintf("%d or more (no maximum)", minBet)
+ }
+ return fmt.Sprintf("between %d and %d", minBet, maxBet)
+}
+
type GameName string
const (
@@ -113,7 +127,7 @@ func (c MachineConfig) Normalize() MachineConfig {
c.MinBet = 1
}
if c.MaxBet <= 0 {
- c.MaxBet = int(^uint(0) >> 1)
+ c.MaxBet = maxBetUnlimited
}
if c.SpinTicks <= 0 {
c.SpinTicks = 2
@@ -138,7 +152,7 @@ func (c TableConfig) Normalize() TableConfig {
c.MinBet = 1
}
if c.MaxBet <= 0 {
- c.MaxBet = int(^uint(0) >> 1)
+ c.MaxBet = maxBetUnlimited
}
return c
}