File size: 1,660 Bytes
9580dce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
export const CATEGORIES = [
  "chess",
  "reading",
  "feynman",
  "logic",
  "critical-thinking",
  "quests",
  "coding",
] as const;

export type Category = (typeof CATEGORIES)[number];

export const CATEGORY_LABELS: Record<Category, string> = {
  chess: "Chess",
  reading: "Deep Reading",
  feynman: "Feynman",
  logic: "Logic Puzzles",
  "critical-thinking": "Critical Thinking",
  quests: "Skill Quests",
  coding: "Coding Training",
};

export const CATEGORY_COLORS: Record<Category, string> = {
  chess: "#f59e0b",
  reading: "#10b981",
  feynman: "#06b6d4",
  logic: "#8b5cf6",
  "critical-thinking": "#f43f5e",
  quests: "#f97316",
  coding: "#3b82f6",
};

export const EXERCISE_XP: Record<
  Category,
  { baseXp: number; maxQualityBonus: number }
> = {
  chess: { baseXp: 20, maxQualityBonus: 20 },
  reading: { baseXp: 30, maxQualityBonus: 30 },
  feynman: { baseXp: 40, maxQualityBonus: 40 },
  logic: { baseXp: 15, maxQualityBonus: 25 },
  "critical-thinking": { baseXp: 50, maxQualityBonus: 30 },
  quests: { baseXp: 25, maxQualityBonus: 25 },
  coding: { baseXp: 45, maxQualityBonus: 35 },
};

export const CRITICAL_HIT_CHANCE = 0.1;
export const CRITICAL_HIT_MULTIPLIER = 2;

/**
 * XP required to go from level N to level N+1.
 * Level 2  → 100 XP
 * Level 10 → ~350 XP
 * Level 50 → ~1,500 XP
 */
export function xpForLevel(level: number): number {
  return Math.round(100 * Math.pow(level / 2, 0.8));
}

/**
 * Total cumulative XP to reach a given level from level 1.
 */
export function totalXpForLevel(level: number): number {
  let total = 0;
  for (let i = 2; i <= level; i++) {
    total += xpForLevel(i);
  }
  return total;
}