// MODULE 02

Exercises & Practice

Interactive exercises with variants, hints, solutions, and self-rating.

How Exercises Work

Exercises live in YAML files under content/exercises/. Each file is named moduleN-variants.yaml and contains warmups and challenges with multiple variants per exercise.

When a user opens a module page, the engine loads the corresponding variant file and renders the exercises below the lesson content.

The Variant System

Each exercise has multiple variants — different problems that test the same concept. The engine picks one variant at random each time, so repeated practice always feels fresh.

id: warmup_1
concept: Variables
variants:
  - id: v1
    title: Declare an integer
    description: "..."
  - id: v2
    title: Declare a string
    description: "..."
  - id: v3
    title: Declare a boolean
    description: "..."

The user sees one variant at a time. They can shuffle to get a different one, or rate their confidence after attempting it.

Self-Rating & SRS

After each exercise, users rate themselves:

Rating Meaning SRS Effect
Got it Solved without help Interval increases
Struggled Solved with difficulty Interval stays short
Had to peek Needed the solution Interval resets

These ratings feed into the spaced repetition system (SRS), which schedules exercises for review at optimal intervals.

Exercise YAML Structure

Here's the full structure of a variant file:

conceptLinks:
  Concept Name: "#lesson-anchor"
sharedContent: {}
variants:
  warmups:
    - id: warmup_1
      concept: Concept Name
      variants:
        - id: v1
          title: Exercise Title
          description: What to do (HTML allowed).
          hints:
            - Hint 1
            - Hint 2
          solution: The solution code
          annotations:
            - type: tip
              label: Label
              text: Explanation.
  challenges: []

Tip: The description, hints, and annotations fields support HTML, so you can use <code>, <strong>, etc.

Daily Practice

The Daily Practice page pulls exercises from across all modules and builds focused sessions. It has four modes:

Exercises

Progress through each section in order, or jump to where you need practice.

Practice individual concepts you just learned.

💪 Challenges

Combine concepts and learn patterns. Each challenge has multiple variants at different difficulties.

Module 2 Summary