clone

fifteen puzzle games for the terminal, with daily puzzles, weekly ladders and xp, built on bubble tea

chore/app-model-decomp
puzzletea / namegen / namegen.go
namegen.go 2.8K
1// Package namegen generates random human-readable names for saved games.2package namegen34import "math/rand/v2"56var adjectives = []string{7 "amber", "ancient", "aqua", "arctic", "autumn",8 "blazing", "bold", "bright", "bronze", "calm",9 "cedar", "celestial", "cherry", "chilly", "citrus",10 "clever", "cobalt", "copper", "coral", "cosmic",11 "crimson", "crystal", "daring", "dawn", "deep",12 "desert", "diamond", "drifting", "dusk", "dusty",13 "eager", "echo", "elegant", "ember", "emerald",14 "endless", "fading", "fierce", "fiery", "floral",15 "foggy", "forest", "frosty", "gentle", "gilded",16 "glacial", "gleaming", "glowing", "golden", "granite",17 "grassy", "hidden", "hollow", "humble", "hushed",18 "icy", "indigo", "iron", "ivory", "jade",19 "keen", "lavender", "lazy", "lemon", "lightning",20 "lofty", "lonely", "lunar", "marble", "meadow",21 "mighty", "misty", "molten", "mossy", "muted",22 "noble", "obsidian", "ocean", "onyx", "opal",23 "pale", "pearl", "pine", "plum", "polar",24 "prairie", "quiet", "radiant", "rapid", "raven",25 "roaming", "ruby", "rustic", "sable", "sage",26 "sandy", "scarlet", "serene", "shadow", "silver",27 "sleepy", "solar", "starry", "steel", "stone",28 "stormy", "sunlit", "swift", "tawny", "tidal",29 "timber", "topaz", "twilight", "velvet", "violet",30 "wandering", "whisper", "wild", "winter", "woven",31}3233var nouns = []string{34 "acorn", "arch", "aurora", "badger", "basalt",35 "beacon", "birch", "bison", "blaze", "boulder",36 "bramble", "brook", "canyon", "cedar", "cliff",37 "cloud", "compass", "condor", "coral", "coyote",38 "crane", "creek", "crest", "crow", "delta",39 "dune", "eagle", "elk", "falcon", "fern",40 "fjord", "flame", "flint", "forge", "fossil",41 "fox", "frost", "geyser", "glacier", "grove",42 "harbor", "hawk", "heath", "heron", "hollow",43 "horizon", "island", "ivy", "jasper", "juniper",44 "lagoon", "lantern", "larch", "lava", "leaf",45 "ledge", "lichen", "lynx", "marsh", "mesa",46 "meteor", "mist", "moon", "moss", "moth",47 "mountain", "nebula", "newt", "oak", "orchid",48 "osprey", "otter", "owl", "peak", "pebble",49 "pine", "plover", "pond", "quail", "quartz",50 "rain", "raptor", "reef", "ridge", "river",51 "robin", "sage", "seal", "sequoia", "shell",52 "shore", "sparrow", "spruce", "star", "stone",53 "storm", "summit", "thistle", "thorn", "tide",54 "timber", "trail", "trout", "vale", "valley",55 "viper", "vista", "willow", "wolf", "wren",56}5758// Generate returns a random "adjective-noun" name.59func Generate() string {60 adj := adjectives[rand.IntN(len(adjectives))]61 noun := nouns[rand.IntN(len(nouns))]62 return adj + "-" + noun63}6465// GenerateSeeded returns a deterministic "adjective-noun" name using the66// provided RNG. Two calls with identically-seeded RNGs produce the same name.67func GenerateSeeded(rng *rand.Rand) string {68 adj := adjectives[rng.IntN(len(adjectives))]69 noun := nouns[rng.IntN(len(nouns))]70 return adj + "-" + noun71}