Repository navigation
Conversation
Questions with fresh numbers every time, so they can't be memorised. A QuestionGenerator (src/lib/questions.ts) produces a question body from a seeded random function; instantiate() seeds it, mixing in the generator's id, and fills in the id, lesson and section. The id stays the same for every seed, so the review queue tracks the skill. Each course can keep generators in src/content/<course>/generators.ts. loadBank adds one instance of each, the exam page draws a fresh seed per attempt, and review gets fresh numbers every session. Computer Networks gets the first three, all built on the lesson's own parseCidr: usable hosts in a /n, and the network and broadcast address of a random private address with a non-octet prefix. Wrong options are real mistakes (forgetting the two reserved addresses, the first or last host, zeroing the wrong octet). Tests run 500 seeds each: four distinct options, one right answer, every position used, and answers that match an independent 32-bit mask calculation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EC6Zzt5akQu7TEHdGquZzp
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EC6Zzt5akQu7TEHdGquZzp
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #108 (→ #105 → #104 → #102 → #101). Merge the exam stack in order.
Exam phase 5a from
docs/exams.md: generated questions, built from the same logic as the lesson, with fresh numbers every time so they can't be memorised.How it works
QuestionGenerator(src/lib/questions.ts):{ id, lesson, section?, generate(random) }.generatereturns the prompt, options, answer and explanation.instantiate(generator, seed)seeds the random function, mixing in the generator's id so two generators never share numbers, and fills in id, lesson and section. The id is the same for every seed, so a review card follows the skill ("find a network address"), not one set of numbers.buildOptions(right, wrong, random)drops duplicate distractors and puts the right answer at a random position.src/content/<course>/generators.ts: one optional file per course.loadBank(course, seed)adds one instance of each generator to the fixed bank. The course page offers an exam for any course with a bank or generators./review, with new numbers every session. Module quizzes are unchanged.The first three: Computer Networks subnets
All three use the lesson's own
parseCidrand link to "Network part and host part":Addresses come from the private ranges, and prefixes avoid octet boundaries so the work happens inside one octet. Each explanation works the steps, for example "/19 splits inside the third octet, where blocks are 32 wide (2⁵). 17 falls in the block starting at 0…", and names the tempting wrong answers.
Tests (
src/test/generated-questions.test.ts)Over 500 seeds per generator:
parseCidritself.exam-page.test.tsxworks out answers for generated questions too, since a 20-question networks exam can now draw them.Checked in the browser: a generated card in
/reviewrenders at 390 px with no errors, shows the right answer and the explanation, and links to "Re-read: IP addresses and subnets".Checks
npm run lint: 0 errors.npm run test: 3,698 passed.npm run build: OK.Next
Generated by Claude Code