Spaces:
Running
Running
Simeon Garratt
feat: question system with categories, shuffle, progressive difficulty, and seeder
db857c8 | export interface Category { | |
| id: number; | |
| name: string; | |
| emoji: string; | |
| } | |
| export const CATEGORIES: Category[] = [ | |
| { id: 9, name: "General Knowledge", emoji: "๐ง " }, | |
| { id: 10, name: "Books", emoji: "๐" }, | |
| { id: 11, name: "Film", emoji: "๐ฌ" }, | |
| { id: 12, name: "Music", emoji: "๐ต" }, | |
| { id: 14, name: "Television", emoji: "๐บ" }, | |
| { id: 15, name: "Video Games", emoji: "๐ฎ" }, | |
| { id: 17, name: "Science & Nature", emoji: "๐ฌ" }, | |
| { id: 18, name: "Computers", emoji: "๐ป" }, | |
| { id: 21, name: "Sports", emoji: "โฝ" }, | |
| { id: 22, name: "Geography", emoji: "๐" }, | |
| { id: 23, name: "History", emoji: "๐" }, | |
| { id: 25, name: "Art", emoji: "๐จ" }, | |
| { id: 27, name: "Animals", emoji: "๐พ" }, | |
| ]; | |
| /** | |
| * Returns the Category object matching the given numeric id, or undefined if not found. | |
| */ | |
| export function getCategoryById(id: number): Category | undefined { | |
| return CATEGORIES.find((c) => c.id === id); | |
| } | |
| /** | |
| * Returns the emoji for the category matching the given name, or "โ" if not found. | |
| */ | |
| export function getCategoryEmoji(name: string): string { | |
| return CATEGORIES.find((c) => c.name === name)?.emoji ?? "โ"; | |
| } | |