Documentation
¶
Index ¶
- func Mode(entry registry.Entry, name string) (game.Spawner, string, error)
- func ModeNames(entry registry.Entry) []string
- func Normalize(s string) string
- func RNGFromString(seed string) *rand.Rand
- func SeededMode(seed string, entries []registry.Entry) (game.SeededSpawner, string, string, error)
- func SeededModeForGame(seed, gameType string, entries []registry.Entry) (game.SeededSpawner, string, string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mode ¶
Mode finds a mode within a game entry by name. If name is empty, returns the first (default) mode.
func Normalize ¶
Normalize lowercases and replaces hyphens/underscores with spaces for fuzzy matching of CLI arguments to mode names.
func RNGFromString ¶ added in v1.5.0
RNGFromString creates a deterministic RNG seeded from an arbitrary string. The string is hashed with FNV-64a to produce a uint64 seed.
func SeededMode ¶ added in v1.5.0
SeededMode selects a game type and mode from all available modes across all categories using rendezvous hashing (highest random weight). Each eligible mode is scored by hashing the seed string together with its (gameType, modeTitle) pair; the highest score wins.
This is resilient to changes in the category/mode lists: adding or removing a mode only affects seeds where the changed entry would have been the winner.
func SeededModeForGame ¶ added in v1.8.0
func SeededModeForGame(seed, gameType string, entries []registry.Entry) (game.SeededSpawner, string, string, error)
SeededModeForGame deterministically selects a seeded mode within a single game definition, so the same seed and game name always produce the same puzzle for that game.
Types ¶
This section is empty.