Download src/shared/nameGenerator.ts from tostido/weed-sim: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/tostido/weed-sim/resolve/main/src/shared/nameGenerator.ts
- Command line
-
hf download hf://spaces/tostido/weed-sim/src/shared/nameGenerator.ts
-
curl -L -o nameGenerator.ts https://huggingface.co/spaces/tostido/weed-sim/resolve/main/src/shared/nameGenerator.ts
1.22 kB
| import { randomChoice, type RandomSource } from './rng'; | |
| import type { PlantType } from './types'; | |
| const PREFIXES: Record<PlantType, string[]> = { | |
| Indica: ['Frost', 'Iron', 'Shadow', 'Glacier', 'Stone', 'Night', 'Crystal', 'Dark', 'Ash', 'Obsidian'], | |
| Sativa: ['Solar', 'Flare', 'Blaze', 'Sky', 'Thunder', 'Fire', 'Sun', 'Lightning', 'Nova', 'Volt'], | |
| Hybrid: [ | |
| 'Velvet', | |
| 'Crimson', | |
| 'Ghost', | |
| 'Nebula', | |
| 'Silver', | |
| 'Phantom', | |
| 'Storm', | |
| 'Echo', | |
| 'Twilight', | |
| 'Lunar', | |
| 'Myco', | |
| 'Drift', | |
| 'Shade', | |
| 'Plasma', | |
| 'Oblivion', | |
| 'Mist', | |
| 'Hollow', | |
| 'Nova', | |
| 'Wisp', | |
| 'Onyx', | |
| 'Zephyr', | |
| 'Glow', | |
| 'Pulse', | |
| 'Eclipse', | |
| 'Spore', | |
| 'Dust', | |
| 'Sable', | |
| 'Prism', | |
| 'Wraith', | |
| 'Ashen', | |
| 'Flicker', | |
| 'Thorn', | |
| 'Rune', | |
| 'Haze', | |
| 'Tide', | |
| 'Shiver', | |
| 'Grime', | |
| 'Rift', | |
| 'Quartz', | |
| 'Solstice', | |
| ], | |
| }; | |
| const MIDDLES = ['leaf', 'bloom', 'root', 'spark', 'shade', 'flare', 'dusk', 'shard', 'pulse', 'drift']; | |
| export function generateName(type: PlantType = 'Hybrid', rng: RandomSource = Math.random): string { | |
| return `${randomChoice(PREFIXES[type] ?? PREFIXES.Hybrid, rng)}${randomChoice(MIDDLES, rng)}`; | |
| } | |