# 26. Teaching with Voltecx

An instructor who gives every student the same circuit gets the same answer back from everyone. This chapter shows how to give each student their own component values, get an answer key for each, and check what a student hands in. It covers the lessons that declare ranges; today that is the course lesson `course-buck`.

## What a lesson declares

A lesson file may carry a `variants` block: the example circuit to start from, the component values that may vary with their range and preferred-number series (E12 or E24, IEC 60063:2015), and the numbers it grades, each with a relative tolerance. A lesson without `variants` has one set of numbers and `lesson.variants` refuses it by name.

## Give every student their numbers

`lesson.variants` takes the lesson `id`, a `seed` and either a list of `students` (any text ids you choose, at most 200) or a `count` (ids `s1` to `sN`):

```sh
powercraft-cli run --cmd lesson.variants \
  --params '{"id":"course-buck","seed":2026,"students":["ana","ben","cy"]}'
```

For each student the reply holds the values, a `setup` list (`file.openExample` and one `circuit.setParam` per value) that rebuilds that student's circuit, and the answer key, measured by running that variant. Your open circuit is not touched: every variant runs in a scratch session. A variant that fails shows its `error` and the others still run.

The same seed and the same id give the same values on every machine, so you can regenerate the key later. Voltecx stores nothing about the student beyond the id text you pass; keep your own list of who has which id.

## Check what a student handed in

`lesson.report` takes the lesson, the same `seed`, the `student` id and the student's `answers` as numbers:

```sh
powercraft-cli run --cmd lesson.report \
  --params '{"id":"course-buck","seed":2026,"student":"ana","answers":{"ripple":0.9,"load-current":5}}'
```

Each answer is marked correct when it lies within the lesson's tolerance of the measured value; a missing answer counts as wrong. `allCorrect` is the summary.

Next: back to the [contents](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/).
