import type { Difficulty } from "./schemas"; /** * Base XP for a correct answer. Harder decks are worth more, and the * multi-part activity types get a small bonus. */ export const XP_BY_DIFFICULTY: Record = { easy: 10, medium: 15, hard: 20, }; const TYPE_BONUS: Record = { matching: 5, ordering: 5, short_answer: 5, }; export function xpForActivity(type: string, difficulty: Difficulty): number { return XP_BY_DIFFICULTY[difficulty] + (TYPE_BONUS[type] ?? 0); } /** Consecutive-correct streak multiplier (capped at 3x). */ export function streakMultiplier(streak: number): number { return Math.min(1 + Math.max(0, streak) * 0.1, 3); }