Files
Vincent Bourdon 9af114e391 Initial import
2026-06-09 16:14:55 +02:00

3.0 KiB

Task 16 — Curriculum module 7 (Grover) + total-count assertion

Index: README. Spec: design.

Goal

Append module 7 (2 Grover exercises, 1 iteration on 2 qubits with markers '11' and '00') and add a final assertion that the curriculum contains exactly 18 exercises.

Prerequisites

  • Task 15 merged.

Files

  • Modify: curriculum/curriculum.json
  • Modify: src/tutor.rs (add the count assertion test)

Steps

  • Step 1: Insert after module 6
,
{
  "id": 7,
  "title": "Algorithme de Grover",
  "lessons": [
    {
      "id": 1,
      "title": "Recherche quantique : amplification d'amplitude",
      "concept": "L'algorithme de Grover retrouve un élément marqué dans N éléments en O(√N) appels — quadratiquement plus rapide que la recherche classique. Il utilise un oracle de phase + un opérateur de diffusion.",
      "example_circuit": "OPENQASM 3.0;\ninclude \"stdgates.inc\";\nqubit[2] q;\nbit[2] c;\nh q[0];\nh q[1];\ncz q[0], q[1];\nh q[0];\nh q[1];\nx q[0];\nx q[1];\ncz q[0], q[1];\nx q[0];\nx q[1];\nh q[0];\nh q[1];\nc = measure q;",
      "what_to_observe": "Grover sur 2 qubits avec marqueur '11' produit '11' avec ~100% après 1 itération.",
      "exercises": [
        {
          "id": "7-1-a",
          "prompt": "Implémente Grover sur 2 qubits pour trouver l'état marqué '11'. 1 itération suffit.",
          "hint": "H H | CZ (oracle) | H H X X CZ X X H H (diffuseur).",
          "criteria": {
            "required_outcomes": [{"bitstring": "11", "min_ratio": 0.85}],
            "forbidden_outcomes": []
          },
          "feedback_pass": "Magnifique ! Grover trouve '11' en une itération avec haute probabilité.",
          "feedback_fail": "L'état '11' doit dominer (>85%). Vérifie oracle et diffuseur."
        },
        {
          "id": "7-1-b",
          "prompt": "Grover pour l'état '00'. Oracle = X X CZ X X.",
          "hint": "X q[0]; X q[1]; CZ q[0],q[1]; X q[0]; X q[1]; puis diffuseur.",
          "criteria": {
            "required_outcomes": [{"bitstring": "00", "min_ratio": 0.85}],
            "forbidden_outcomes": []
          },
          "feedback_pass": "Excellent ! En changeant l'oracle, Grover trouve n'importe quel état marqué.",
          "feedback_fail": "L'état '00' doit dominer (>85%). Ton oracle doit marquer '00'."
        }
      ]
    }
  ]
}
  • Step 2: Append a total-count assertion in src/tutor.rs

Inside the existing #[cfg(test)] mod tests:

    #[test]
    fn curriculum_has_18_exercises_total() {
        let loader = CurriculumLoader::default();
        assert_eq!(loader.all_exercises().len(), 18);
    }
  • Step 3: Verify
cargo test tutor::tests 2>&1 | grep -E "test result|FAILED"

Expected: every tutor test passes; the new assertion confirms 18 exercises across 7 modules.

  • Step 4: Commit
git add curriculum/curriculum.json src/tutor.rs
git commit -m "feat: add curriculum module 7 (Grover) and 18-exercise total assertion"