Fable will fix it!

This commit is contained in:
2026-06-11 15:57:08 -07:00
parent 2af98a3eeb
commit 443acd8400
23 changed files with 2151 additions and 557 deletions

View File

@@ -1416,8 +1416,22 @@ const SUGGESTIONS = {
]
};
export function getSuggestion(type) {
const arr = SUGGESTIONS[type];
export function getSuggestion(type, exclude = []) {
let arr = SUGGESTIONS[type];
if (!arr) return "";
const taken = new Set(exclude.map(s => s.trim().toLowerCase()));
const available = arr.filter(s => !taken.has(s.trim().toLowerCase()));
if (available.length > 0) arr = available;
return arr[Math.floor(Math.random() * arr.length)];
}
// Draws `count` distinct suggestions from a pool.
export function getSuggestions(type, count) {
const picked = [];
for (let i = 0; i < count; i++) {
const s = getSuggestion(type, picked);
if (!s) break;
picked.push(s);
}
return picked;
}