Documentation
¶
Index ¶
- Variables
- func Category(name string, categories []list.Item) (game.Category, error)
- func CategoryNames(categories []list.Item) []string
- func Mode(cat game.Category, name string) (game.Spawner, string, error)
- func ModeNames(cat game.Category) []string
- func Normalize(s string) string
- func RNGFromString(seed string) *rand.Rand
- func SeededMode(seed string, categories []list.Item) (game.SeededSpawner, string, string, error)
Constants ¶
This section is empty.
Variables ¶
var CategoryAliases = map[string]string{
"hashi": "hashiwokakero",
"bridges": "hashiwokakero",
"hitori": "hitori",
"lights": "lights out",
"nonogram": "nonogram",
"nurikabe": "nurikabe",
"islands": "nurikabe",
"sea": "nurikabe",
"sudoku": "sudoku",
"takuzu": "takuzu",
"binairo": "takuzu",
"binary": "takuzu",
"shikaku": "shikaku",
"rectangles": "shikaku",
"words": "word search",
"wordsearch": "word search",
"ws": "word search",
}
CategoryAliases maps short or alternate names to canonical category names.
Functions ¶
func Category ¶
Category finds a game category by name (case-insensitive, hyphen/underscore-tolerant, with alias support).
func CategoryNames ¶
CategoryNames returns the display names of all game categories.
func Mode ¶
Mode finds a mode within a category 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 game/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.
Types ¶
This section is empty.