diff options
| author | historia <[not public]> | 2026-09-29 13:28:06 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-29 13:28:06 -0400 |
| commit | 9803facd4368420a5dce3af59c835e13cb015cf5 (patch) | |
| tree | 4ecb75f9c88b16ae72d3573bef026d760eb8d7a8 /internal/casino/registry.go | |
| parent | 13db3e50cb6e29eedbf25416e5284bf08b0adefb (diff) | |
| download | thehouseoficarus-9803facd4368420a5dce3af59c835e13cb015cf5.tar.gz | |
feat: roulette in domita casino
Diffstat (limited to 'internal/casino/registry.go')
| -rw-r--r-- | internal/casino/registry.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/internal/casino/registry.go b/internal/casino/registry.go index 26acd8c..f27f7bd 100644 --- a/internal/casino/registry.go +++ b/internal/casino/registry.go @@ -1,6 +1,9 @@ package casino -import "math/rand" +import ( + "fmt" + "math/rand" +) // tableGameDef is the single registration point for a multiplayer table game. // A game's validation, rule defaults, and constructor live together here, so @@ -31,6 +34,23 @@ var tableGames map[GameName]tableGameDef func init() { tableGames = map[GameName]tableGameDef{ + GameRoulette: { + validate: func(c TableConfig) error { + if c.Roulette.SpinTicks < 0 || c.Roulette.SpinTicks > maxSpinTicks { + return fmt.Errorf("roulette spin_ticks must be between 0 and %d", maxSpinTicks) + } + return nil + }, + normalize: func(c TableConfig) TableConfig { + if c.Roulette.SpinTicks == 0 { + c.Roulette.SpinTicks = 3 + } + return c + }, + ruleBlockName: "roulette", + hasRuleBlock: func(c TableConfig) bool { return c.Roulette != (RouletteConfig{}) }, + new: func(roomID int, cfg TableConfig, rng *rand.Rand) tableGame { return newRouletteTable(roomID, cfg, rng) }, + }, GameBlackjack: { validate: validateBlackjackTable, normalize: normalizeBlackjackTable, |
