aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/registry.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/registry.go')
-rw-r--r--internal/casino/registry.go22
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,