diff options
Diffstat (limited to 'internal/casino/types.go')
| -rw-r--r-- | internal/casino/types.go | 18 |
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 } |
