Interactive Textbook — v2 Group highlights · Diagram quizzes · Mobile stack · Authoring sketch

VERSION v2
FIDELITY wireframe
FROM  v1 · Side Panel

Diagrams span paragraphs

One diagram ↔ a group of related paragraphs. Hover/tap any paragraph → its matching components pulse; other paragraphs in the same group get a light tint so you see the scope.

Quiz mode, same diagram

The memory diagrams are reused as assessment: code → diagram (fill the boxes) and diagram → code (fill the code). Lives on dedicated quiz pages inside the chapter.

Mobile = stacked

Side panels don't work on a phone. Mobile inlines the diagram directly under its group, collapses by default, and gives quizzes a dedicated screen.

Authoring stays markdown

Extend Quartz-flavoured markdown with {#group} attrs and a ::: diagram directive. Instructors write prose as normal; the build wires up the interactions.

keys 14
v2 1 · READING
fundamentals-of-computer-science.github.io / ch-2 / data-and-memory
⌘K search
Chapter 2 · Values and Memory
2.1Values live in boxes
Idea: paragraphs are marked with a ① ② ③ group that maps to one region of the diagram. ·Hover / tap a paragraph → its group pulses in the diagram. Other paragraphs in the same group get lightly tinted so you see the reach of the diagram. ·Hover a cell → every paragraph that talks about it tints in the margin rail.
Group ① — single value Group ② — copy semantics Group ③ — independence

Before we can talk about variables, we need a word for the things variables hold. A value is a piece of data your program can compute with — a truth, a number, a piece of text. Each value has a type, and the type decides what you can do with it.

The simplest case is a single value type like int. When you write int x = 5;, the compiler reserves a small, fixed-size slot of memory, labels it x, and writes the literal 5 into that slot.

The slot is the box. Its contents are the value. That's the entire mental model you need for primitive types: box + contents, nothing more.

Now look at the next line: int y = x;. This copies the value out of x's box and writes it into a brand-new box named y. Crucially, no link is drawn between the two boxes — they each hold their own 5.

This is why int (and every other value type) is sometimes called a copy type. Assignment copies; it does not share.

The payoff is on the third line: y = y + 1;. We add one to y. Only y's box changes. x still holds 5 — its box was never touched.

Chapter 4 introduces reference types, which behave differently. For this chapter, though, every value you create is its own little island, copied on assignment and changed in place.

Memory — walkthrough of int x=5; int y=x; y=y+1;
0x7ffc005x
0x7ffc046y
0x7ffc005x (still)
0x7ffc0c
int x = 5; // ① box x ← 5 int y = x; // ② copy 5 into box y y = y + 1; // ③ only y changes // x is still 5 — boxes are independent

hover a paragraph, code line, or cell — all three in the same group pulse together.

1.1
1.2
1.3
2.0
2.1 Values
2.1Q
2.2 Bind
2.3 Scope
2.3Q
2.4 Copy
2.5
2Q
concept 5 / 12

Open questions for v3

· Should groups auto-advance as you scroll — pulsing ① then ② then ③ based on reading position?
· In quizzes, do we want partial-credit scoring or strict all-or-nothing?
· Do we want a "reveal all diagrams" printable view for studying offline?
· For diagram → code mode, compile + run in-browser (C# via WebAssembly) or just string-match?

Likely next moves

→ Commit to the {#group} + ::: diagram authoring shape, then prototype against one real chapter.
→ Decide whether quiz state (progress, scores) gets stored locally only or synced to an account.
→ Figure out the diagram vocabulary: memory boxes cover most of Chapters 1–3, but linked lists in Chapter 4 need pointers/arrows.
→ Mid-fi pass on the reading layout with the real typography of your site.

Tweaks