difficultyInstruction static method

String difficultyInstruction(
  1. double recentAccuracy
)

Build a difficulty instruction string for injection into system prompts.

Implementation

static String difficultyInstruction(double recentAccuracy) {
  final level = difficultyLevel(recentAccuracy);
  final pct = (recentAccuracy * 100).round();
  return switch (level) {
    DifficultyLevel.harder =>
      'DIFFICULTY TARGETING: Learner accuracy is $pct% (above 85%). '
          'Increase question difficulty: use multi-step problems, edge cases, '
          'or require deeper analysis.',
    DifficultyLevel.maintain =>
      'DIFFICULTY TARGETING: Learner accuracy is $pct% (in zone). '
          'Maintain current difficulty level.',
    DifficultyLevel.easier =>
      'DIFFICULTY TARGETING: Learner accuracy is $pct% (below 70%). '
          'Decrease difficulty: use simpler, more focused questions. Break '
          'complex concepts into smaller parts.',
  };
}