summaryrefslogtreecommitdiff
path: root/examples/noc/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-16 21:28:20 -0300
committerGabriel Schneider <[email protected]>2026-11-16 21:28:20 -0300
commit6933f99ddb2d7103515d26838496309a807bba26 (patch)
tree991c2fe7d4a57957222876e190fa4d16a0fb889c /examples/noc/test
parent82fca5c9f29124f37f6dcd08e73e6999ce44a69d (diff)
downloadsketchbook-6933f99ddb2d7103515d26838496309a807bba26.tar.gz
sketchbook-6933f99ddb2d7103515d26838496309a807bba26.zip
Move standalone sketches into sketchbook examples
Diffstat (limited to 'examples/noc/test')
-rw-r--r--examples/noc/test/accel_to_mouse.reload.script31
-rw-r--r--examples/noc/test/accel_to_mouse.script18
-rw-r--r--examples/noc/test/accel_to_mouse.timeline.script62
-rw-r--r--examples/noc/test/additive_blending.reload.script33
-rw-r--r--examples/noc/test/additive_blending.script18
-rw-r--r--examples/noc/test/additive_blending.timeline.script58
-rw-r--r--examples/noc/test/angular_forces.reload.script30
-rw-r--r--examples/noc/test/angular_forces.script8
-rw-r--r--examples/noc/test/angular_forces.timeline.script52
-rw-r--r--examples/noc/test/bin_lattice.reload.script32
-rw-r--r--examples/noc/test/bin_lattice.script32
-rw-r--r--examples/noc/test/bin_lattice.timeline.script71
-rw-r--r--examples/noc/test/bouncing_ball.reload.script30
-rw-r--r--examples/noc/test/bouncing_ball.script8
-rw-r--r--examples/noc/test/bouncing_ball.timeline.script52
-rw-r--r--examples/noc/test/flappy_bird.reload.script33
-rw-r--r--examples/noc/test/flappy_bird.script94
-rw-r--r--examples/noc/test/flappy_bird.timeline.script68
-rw-r--r--examples/noc/test/flocking.reload.script30
-rw-r--r--examples/noc/test/flocking.script21
-rw-r--r--examples/noc/test/flocking.timeline.script70
-rw-r--r--examples/noc/test/flow_field.reload.script27
-rw-r--r--examples/noc/test/flow_field.script15
-rw-r--r--examples/noc/test/flow_field.timeline.script60
-rw-r--r--examples/noc/test/fluid_resistance.reload.script32
-rw-r--r--examples/noc/test/fluid_resistance.script13
-rw-r--r--examples/noc/test/fluid_resistance.timeline.script58
-rw-r--r--examples/noc/test/koch.reload.script28
-rw-r--r--examples/noc/test/koch.script20
-rw-r--r--examples/noc/test/koch.timeline.script68
-rw-r--r--examples/noc/test/lsystem.reload.script28
-rw-r--r--examples/noc/test/lsystem.script16
-rw-r--r--examples/noc/test/lsystem.timeline.script68
-rw-r--r--examples/noc/test/noise_walker.reload.script31
-rw-r--r--examples/noc/test/noise_walker.script22
-rw-r--r--examples/noc/test/noise_walker.timeline.script57
-rw-r--r--examples/noc/test/path_following.reload.script28
-rw-r--r--examples/noc/test/path_following.script22
-rw-r--r--examples/noc/test/path_following.timeline.script61
-rw-r--r--examples/noc/test/pendulum.reload.script26
-rw-r--r--examples/noc/test/pendulum.script18
-rw-r--r--examples/noc/test/pendulum.timeline.script68
-rw-r--r--examples/noc/test/quadtree.reload.script30
-rw-r--r--examples/noc/test/quadtree.script15
-rw-r--r--examples/noc/test/quadtree.timeline.script70
-rw-r--r--examples/noc/test/random_walk.reload.script31
-rw-r--r--examples/noc/test/random_walk.script7
-rw-r--r--examples/noc/test/random_walk.timeline.script57
-rw-r--r--examples/noc/test/recursive_tree.reload.script26
-rw-r--r--examples/noc/test/recursive_tree.script22
-rw-r--r--examples/noc/test/recursive_tree.timeline.script57
-rw-r--r--examples/noc/test/smoke.reload.script33
-rw-r--r--examples/noc/test/smoke.script28
-rw-r--r--examples/noc/test/smoke.timeline.script58
-rw-r--r--examples/noc/test/system_of_systems.reload.script33
-rw-r--r--examples/noc/test/system_of_systems.script18
-rw-r--r--examples/noc/test/system_of_systems.timeline.script59
-rw-r--r--examples/noc/test/the_wave.reload.script26
-rw-r--r--examples/noc/test/the_wave.script6
-rw-r--r--examples/noc/test/the_wave.timeline.script54
-rw-r--r--examples/noc/test/wolfram_ca.reload.script26
-rw-r--r--examples/noc/test/wolfram_ca.script12
-rw-r--r--examples/noc/test/wolfram_ca.timeline.script56
63 files changed, 2341 insertions, 0 deletions
diff --git a/examples/noc/test/accel_to_mouse.reload.script b/examples/noc/test/accel_to_mouse.reload.script
new file mode 100644
index 0000000..ab516af
--- /dev/null
+++ b/examples/noc/test/accel_to_mouse.reload.script
@@ -0,0 +1,31 @@
+# Live reload (design.md "Acceptance: live reload"): play a while, pause a
+# replay so State holds still, load the edited build ({v2}: a smaller ball),
+# check that State carried over and the picture changed where the edit shows.
+move 560 300
+frames 60
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect position[0] 581.173 ~0.001
+expect position[1] 310.586 ~0.001
+expect velocity[0] 3.5777 ~0.001
+screenshot .zig-cache/e2e/accel_to_mouse-before.png
+frames 1
+load {v2}
+expect position[0] 581.173 ~0.001
+expect position[1] 310.586 ~0.001
+expect velocity[0] 3.5777 ~0.001
+frames 2
+screenshot .zig-cache/e2e/accel_to_mouse-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/accel_to_mouse-before.png .zig-cache/e2e/accel_to_mouse-after.png 553 284 48 48
+# Playing on after the reload: State goes on from where it was.
+console pause
+frames 10
+expect position[0] 607.111 ~0.001
+expect position[1] 323.555 ~0.001
+expect velocity[0] 1.7889 ~0.001
diff --git a/examples/noc/test/accel_to_mouse.script b/examples/noc/test/accel_to_mouse.script
new file mode 100644
index 0000000..7c3339d
--- /dev/null
+++ b/examples/noc/test/accel_to_mouse.script
@@ -0,0 +1,18 @@
+# The mover chases the pointer to the lower right: within its radius (24)
+# after a second, past it after a second and a half, back inside after two.
+# Then it turns around after the pointer to the upper left.
+move 560 300
+frames 64
+expect position[0] 560 ~24
+expect position[1] 300 ~24
+frames 26
+expect position[0] 615.2 ~0.1
+expect position[1] 327.5 ~0.1
+frames 30
+expect position[0] 560 ~24
+expect position[1] 300 ~24
+move 80 60
+frames 40
+expect velocity[0] -4.47 ~0.01
+expect velocity[1] -2.24 ~0.01
+screenshot .zig-cache/e2e/accel_to_mouse.png
diff --git a/examples/noc/test/accel_to_mouse.timeline.script b/examples/noc/test/accel_to_mouse.timeline.script
new file mode 100644
index 0000000..22ac8ac
--- /dev/null
+++ b/examples/noc/test/accel_to_mouse.timeline.script
@@ -0,0 +1,62 @@
+# Timeline check, the template for every example (design.md "Acceptance:
+# timeline"): record some interaction, then every way of replaying it must
+# land exactly on the state it stopped at. The mover's path depends on
+# where the pointer was at every frame, so a replay that batched frames or
+# started from other input state would end elsewhere.
+#
+# Copy it, keep the console lines, and replace the input between `record`
+# and `save` with the example's own (clicks, drags, keys), a few seconds.
+
+# 1. Record. Input before `record` is the state the recording starts from.
+move 560 300
+console snapshot 1
+console record 0
+frames 30
+move 100 80
+frames 40
+move 400 250
+frames 30
+# Saving stops the recording first: slot 2 is the state at the stop.
+console save 2
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/accel_to_mouse-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/accel_to_mouse-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/accel_to_mouse-played.png .zig-cache/e2e/accel_to_mouse-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/additive_blending.reload.script b/examples/noc/test/additive_blending.reload.script
new file mode 100644
index 0000000..a3d499a
--- /dev/null
+++ b/examples/noc/test/additive_blending.reload.script
@@ -0,0 +1,33 @@
+# Live reload (design.md "Acceptance: live reload"): play a while, pause a
+# replay so State holds still, load the edited build ({v2}: blue glow), check that
+# State carried over and the picture changed.
+move 480 200
+frames 60
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect clock.count 71
+expect particles.len 123
+expect particles.buffer[0].position[0] 390.325 ~0.001
+expect particles.buffer[0].position[1] 266.726 ~0.001
+screenshot .zig-cache/e2e/additive_blending-before.png
+frames 1
+load {v2}
+expect clock.count 71
+expect particles.len 123
+expect particles.buffer[0].position[0] 390.325 ~0.001
+expect particles.buffer[0].position[1] 266.726 ~0.001
+frames 2
+screenshot .zig-cache/e2e/additive_blending-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/additive_blending-before.png .zig-cache/e2e/additive_blending-after.png
+# Playing on after the reload: State goes on from where it was.
+console pause
+frames 10
+expect clock.count 81
+expect particles.buffer[0].position[0] 411.893 ~0.001
+expect particles.buffer[0].position[1] 231.211 ~0.001
diff --git a/examples/noc/test/additive_blending.script b/examples/noc/test/additive_blending.script
new file mode 100644
index 0000000..9c0dc6a
--- /dev/null
+++ b/examples/noc/test/additive_blending.script
@@ -0,0 +1,18 @@
+# The pointer at three quarters of the width: a wind of 0.1 to the right.
+move 480 200
+frames 120
+expect wind 0.1 ~0.000001
+# Three particles a step, each living 41 steps.
+expect particles.len 123
+expect particles.buffer[0].lifespan 0
+expect particles.buffer[0].position[0] 401.646 ~0.01
+screenshot .zig-cache/e2e/additive_blending.png
+frames 1
+# Added up, the particles saturate to white where they crowd (4.8's
+# smoke, blended over, stays gray there: 244), and glow magenta
+# (255, 100, 255 at each particle's lifespan) where they thin out.
+expect-pixel .zig-cache/e2e/additive_blending.png 320 285 255 255 255 255
+expect-pixel .zig-cache/e2e/additive_blending.png 344 252 255 119 255 255 3
+expect-pixel .zig-cache/e2e/additive_blending.png 100 100 0 0 0 255
+# The arrow is added too: white on black either way.
+expect-pixel .zig-cache/e2e/additive_blending.png 340 49 127 127 127 255 2
diff --git a/examples/noc/test/additive_blending.timeline.script b/examples/noc/test/additive_blending.timeline.script
new file mode 100644
index 0000000..77306d4
--- /dev/null
+++ b/examples/noc/test/additive_blending.timeline.script
@@ -0,0 +1,58 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script: the pointer's x is the wind every step,
+# and the particles' Gaussian draws come from State's generator. The
+# screenshot checks cover the additive blend.
+
+# 1. Record. Input before `record` is the state the recording starts from.
+move 560 300
+console snapshot 1
+console record 0
+frames 30
+move 100 80
+frames 40
+move 400 250
+frames 30
+# Saving stops the recording first: slot 2 is the state at the stop.
+console save 2
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/additive_blending-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/additive_blending-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/additive_blending-played.png .zig-cache/e2e/additive_blending-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/angular_forces.reload.script b/examples/noc/test/angular_forces.reload.script
new file mode 100644
index 0000000..6b17558
--- /dev/null
+++ b/examples/noc/test/angular_forces.reload.script
@@ -0,0 +1,30 @@
+# Live reload (design.md "Acceptance: live reload"): play a while, pause a
+# replay so State holds still, load the edited build ({v2}: a red attractor),
+# check that State carried over and the picture changed where the edit shows.
+frames 120
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect movers[0].position[0] 243.076 ~0.001
+expect movers[0].angle -2.41708 ~0.001
+expect clock.count 130
+screenshot .zig-cache/e2e/angular_forces-before.png
+frames 1
+load {v2}
+expect movers[0].position[0] 243.076 ~0.001
+expect movers[0].angle -2.41708 ~0.001
+expect clock.count 130
+frames 2
+screenshot .zig-cache/e2e/angular_forces-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/angular_forces-before.png .zig-cache/e2e/angular_forces-after.png 300 160 40 40
+# Playing on after the reload: State goes on from where it was.
+console pause
+frames 10
+expect movers[0].position[0] 237.003 ~0.001
+expect movers[0].angle -1.41708 ~0.001
+expect clock.count 140
diff --git a/examples/noc/test/angular_forces.script b/examples/noc/test/angular_forces.script
new file mode 100644
index 0000000..0e44501
--- /dev/null
+++ b/examples/noc/test/angular_forces.script
@@ -0,0 +1,8 @@
+# Four seconds of orbits. The clock is one step behind the frames: the
+# first tick has dt 0.
+frames 240
+expect clock.count 239
+expect movers[0].position[0] 313.456 ~0.01
+expect movers[0].angle 8.4829 ~0.001
+expect movers[19].position[1] 52.813 ~0.01
+screenshot .zig-cache/e2e/angular_forces.png
diff --git a/examples/noc/test/angular_forces.timeline.script b/examples/noc/test/angular_forces.timeline.script
new file mode 100644
index 0000000..83cafff
--- /dev/null
+++ b/examples/noc/test/angular_forces.timeline.script
@@ -0,0 +1,52 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. No input: the recording is just frames of
+# orbits; the live move in 6. must not matter.
+
+# 1. Record.
+frames 30
+console record 0
+frames 100
+# Saving stops the recording first: slot 2 is the state at the stop.
+console save 2
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/angular_forces-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/angular_forces-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/angular_forces-played.png .zig-cache/e2e/angular_forces-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/bin_lattice.reload.script b/examples/noc/test/bin_lattice.reload.script
new file mode 100644
index 0000000..5e158b5
--- /dev/null
+++ b/examples/noc/test/bin_lattice.reload.script
@@ -0,0 +1,32 @@
+# Live reload keeps State: a drag, a paused replay, the edited build ({v2}:
+# blue bodies), the same boids and grid after it, then play on.
+frames 60
+down 300 200
+move 320 200
+move 340 200
+up 340 200
+frames 30
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect boids.len 2002
+expect boids.buffer[2001].position[0] 299.080 ~0.01
+expect grid.order[0] 490
+screenshot .zig-cache/e2e/bin_lattice-before.png
+frames 1
+load {v2}
+expect boids.len 2002
+expect boids.buffer[2001].position[0] 299.080 ~0.01
+expect grid.order[0] 490
+frames 2
+screenshot .zig-cache/e2e/bin_lattice-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/bin_lattice-before.png .zig-cache/e2e/bin_lattice-after.png
+# Unpaused: the replay goes on from where it was.
+console pause
+frames 15
+expect clock.count 119
diff --git a/examples/noc/test/bin_lattice.script b/examples/noc/test/bin_lattice.script
new file mode 100644
index 0000000..e0d03ac
--- /dev/null
+++ b/examples/noc/test/bin_lattice.script
@@ -0,0 +1,32 @@
+# 2000 boids start at random places and gather into flocks. Each looks only
+# at the boids binned in its own and the 8 surrounding 40-pixel cells: the
+# grid in State holds every boid once, in cell order. A drag adds one boid
+# per pointer move while the button is down (mouseDragged).
+frames 3
+expect boids.len 2000
+expect grid.start[0] 0
+expect grid.start[144] 2000
+frames 117
+expect clock.count 119
+expect boids.buffer[0].position[0] 87.396 ~0.01
+expect boids.buffer[0].position[1] 160.950 ~0.01
+expect boids.buffer[1999].position[0] 336.283 ~0.01
+# The top-left cell is empty now; boid 207 is the first in cell order.
+expect grid.start[1] 0
+expect grid.order[0] 207
+down 100 300
+move 110 300
+move 120 300
+move 130 300
+up 130 300
+expect boids.len 2003
+# The last one was added at (130, 300) and has flown a step since.
+expect boids.buffer[2002].position[0] 131.087 ~0.01
+move 200 200
+expect boids.len 2003
+frames 1
+expect grid.start[144] 2003
+# The pointer's 3x3 cells are shaded.
+move 300 200
+frames 60
+screenshot .zig-cache/e2e/bin_lattice.png
diff --git a/examples/noc/test/bin_lattice.timeline.script b/examples/noc/test/bin_lattice.timeline.script
new file mode 100644
index 0000000..97d5c0d
--- /dev/null
+++ b/examples/noc/test/bin_lattice.timeline.script
@@ -0,0 +1,71 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction is drags: each pointer
+# move with the button down adds a boid there, and the grid is rebuilt from
+# the boids at every step, so a replay must see every move, with the button
+# state of its own frame.
+
+# 1. Record.
+frames 30
+console snapshot 1
+console record 0
+frames 10
+down 100 100
+move 120 110
+move 140 120
+frames 5
+move 160 130
+up 160 130
+frames 20
+# A move without the button adds nothing.
+move 300 200
+down 500 300
+move 480 280
+move 460 260
+move 440 240
+up 440 240
+frames 30
+expect boids.len 2006
+console save 2
+
+# 2. Played to the end, exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/bin_lattice-played.png
+# 5. Paused: `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/bin_lattice-sought.png
+# 7. What a seek shows equals what playing showed.
+expect-same-screenshot .zig-cache/e2e/bin_lattice-played.png .zig-cache/e2e/bin_lattice-sought.png
+console seek 600
+console pause
+frames 10
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live drag (two boids, and the button left down), then the same replay.
+console stop
+down 20 20
+move 30 30
+move 40 40
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/bouncing_ball.reload.script b/examples/noc/test/bouncing_ball.reload.script
new file mode 100644
index 0000000..6eee3e7
--- /dev/null
+++ b/examples/noc/test/bouncing_ball.reload.script
@@ -0,0 +1,30 @@
+# Live reload (design.md "Acceptance: live reload"): play a while, pause a
+# replay so State holds still, load the edited build ({v2}: a darker ball),
+# check that State carried over and the picture changed where the edit shows.
+frames 240
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect position[0] 560 ~0.001
+expect position[1] 124 ~0.001
+expect velocity[1] -2 ~0.001
+screenshot .zig-cache/e2e/bouncing_ball-before.png
+frames 1
+load {v2}
+expect position[0] 560 ~0.001
+expect position[1] 124 ~0.001
+expect velocity[1] -2 ~0.001
+frames 2
+screenshot .zig-cache/e2e/bouncing_ball-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/bouncing_ball-before.png .zig-cache/e2e/bouncing_ball-after.png 538 102 48 48
+# Playing on after the reload: State goes on from where it was.
+console pause
+frames 10
+expect position[0] 535 ~0.001
+expect position[1] 104 ~0.001
+expect velocity[1] -2 ~0.001
diff --git a/examples/noc/test/bouncing_ball.script b/examples/noc/test/bouncing_ball.script
new file mode 100644
index 0000000..b9e6a74
--- /dev/null
+++ b/examples/noc/test/bouncing_ball.script
@@ -0,0 +1,8 @@
+# x passes 640 after 216 steps, y passes 360 after 130: by frame 300 the
+# ball has come off both walls and heads back up-left.
+frames 300
+expect velocity[0] -2.5
+expect velocity[1] -2
+expect position[0] 437.5 ~0.01
+expect position[1] 26 ~0.01
+screenshot .zig-cache/e2e/bouncing_ball.png
diff --git a/examples/noc/test/bouncing_ball.timeline.script b/examples/noc/test/bouncing_ball.timeline.script
new file mode 100644
index 0000000..563e85f
--- /dev/null
+++ b/examples/noc/test/bouncing_ball.timeline.script
@@ -0,0 +1,52 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The ball takes no input, so the recording
+# is just frames, across the bounce off the floor; the live move in 6. must not matter.
+
+# 1. Record.
+frames 100
+console record 0
+frames 100
+# Saving stops the recording first: slot 2 is the state at the stop.
+console save 2
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/bouncing_ball-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/bouncing_ball-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/bouncing_ball-played.png .zig-cache/e2e/bouncing_ball-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/flappy_bird.reload.script b/examples/noc/test/flappy_bird.reload.script
new file mode 100644
index 0000000..7fa8d33
--- /dev/null
+++ b/examples/noc/test/flappy_bird.reload.script
@@ -0,0 +1,33 @@
+# Live reload keeps State: a round being played back, paused, the edited
+# build ({v2}: green pipes), the same bird and pipes after it, then play on.
+frames 10
+console record 0
+frames 15
+key space
+frames 15
+key space
+frames 15
+key space
+frames 15
+key space
+frames 15
+console stop
+console play 0
+frames 50
+console pause
+frames 2
+expect bird.y 218.916 ~0.001
+expect pipes.buffer[0].x 520 ~0.001
+screenshot .zig-cache/e2e/flappy_bird-before.png
+frames 1
+load {v2}
+expect bird.y 218.916 ~0.001
+expect pipes.buffer[0].x 520 ~0.001
+frames 2
+screenshot .zig-cache/e2e/flappy_bird-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/flappy_bird-before.png .zig-cache/e2e/flappy_bird-after.png
+# Unpaused: the replay goes on from where it was.
+console pause
+frames 20
+expect clock.count 80
diff --git a/examples/noc/test/flappy_bird.script b/examples/noc/test/flappy_bird.script
new file mode 100644
index 0000000..8289848
--- /dev/null
+++ b/examples/noc/test/flappy_bird.script
@@ -0,0 +1,94 @@
+# The bird falls; space (or a click) flaps. Pipes come every 100 steps
+# from the right; passing one scores. The script flaps whenever the bird
+# is down to about 295, which takes it through the first two gaps (the
+# first is 237..337), then lets it drop: past one more pipe, onto the next.
+# The round ends ("OOPS!"), nothing moves, and a click starts the next
+# round, keeping the best score.
+expect pipes.buffer[0].top 236.904 ~0.001
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+await bird.y 295 ~10
+key space
+frames 8
+expect score 2
+expect over false
+screenshot .zig-cache/e2e/flappy_bird.png
+await over true
+expect score 3
+expect best 3
+frames 30
+expect over true
+screenshot .zig-cache/e2e/flappy_bird-over.png
+click 320 180
+expect over false
+expect score 0
+expect best 3
+expect pipes.len 1
+expect bird.y 120
diff --git a/examples/noc/test/flappy_bird.timeline.script b/examples/noc/test/flappy_bird.timeline.script
new file mode 100644
index 0000000..27c2576
--- /dev/null
+++ b/examples/noc/test/flappy_bird.timeline.script
@@ -0,0 +1,68 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction: flaps by click and by
+# space at chosen frames, a crash on the second pipe's way, and a click
+# that starts a new round with a new pipe from the State's generator. A
+# replay that lost or moved one flap ends with the bird elsewhere.
+
+# 1. Record.
+frames 20
+console record 0
+frames 40
+key space
+frames 10
+click 300 200
+frames 25
+key space
+frames 25
+click 300 200
+await over true
+frames 10
+click 300 200
+frames 30
+key space
+frames 20
+console save 2
+expect over false
+expect best 0
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 400
+expect-snapshot 2
+screenshot .zig-cache/e2e/flappy_bird-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/flappy_bird-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/flappy_bird-played.png .zig-cache/e2e/flappy_bird-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 400
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 400
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/flocking.reload.script b/examples/noc/test/flocking.reload.script
new file mode 100644
index 0000000..3af0d12
--- /dev/null
+++ b/examples/noc/test/flocking.reload.script
@@ -0,0 +1,30 @@
+# Live reload keeps State: a drag, a paused replay, the edited build ({v2}:
+# red bodies), the same boids after it, then play on.
+frames 60
+down 300 200
+move 320 200
+move 340 200
+up 340 200
+frames 30
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect boids.len 122
+expect boids.buffer[121].position[0] 294.264 ~0.01
+screenshot .zig-cache/e2e/flocking-before.png
+frames 1
+load {v2}
+expect boids.len 122
+expect boids.buffer[121].position[0] 294.264 ~0.01
+frames 2
+screenshot .zig-cache/e2e/flocking-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/flocking-before.png .zig-cache/e2e/flocking-after.png
+# Unpaused: the replay goes on from where it was.
+console pause
+frames 15
+expect clock.count 119
diff --git a/examples/noc/test/flocking.script b/examples/noc/test/flocking.script
new file mode 100644
index 0000000..7988bd1
--- /dev/null
+++ b/examples/noc/test/flocking.script
@@ -0,0 +1,21 @@
+# 120 boids burst from the center and form flocks; a drag adds one boid per
+# pointer move while the button is down (mouseDragged), none for the press.
+frames 120
+expect boids.len 120
+down 100 300
+move 110 300
+move 120 300
+move 130 300
+move 140 300
+move 150 300
+up 150 300
+expect boids.len 125
+# The last one was added at (150, 300) and has flown a step since.
+expect boids.buffer[124].position[0] 150.77 ~0.01
+# A move without the button adds none.
+move 200 200
+expect boids.len 125
+frames 120
+expect boids.buffer[0].position[0] 583.371 ~0.01
+expect boids.buffer[0].position[1] 327.445 ~0.01
+screenshot .zig-cache/e2e/flocking.png
diff --git a/examples/noc/test/flocking.timeline.script b/examples/noc/test/flocking.timeline.script
new file mode 100644
index 0000000..9047d33
--- /dev/null
+++ b/examples/noc/test/flocking.timeline.script
@@ -0,0 +1,70 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction is drags: each pointer
+# move with the button down adds a boid there, so a replay must see every
+# move, with the button state of its own frame.
+
+# 1. Record.
+frames 30
+console snapshot 1
+console record 0
+frames 10
+down 100 100
+move 120 110
+move 140 120
+frames 5
+move 160 130
+up 160 130
+frames 20
+# A move without the button adds nothing.
+move 300 200
+down 500 300
+move 480 280
+move 460 260
+move 440 240
+up 440 240
+frames 30
+expect boids.len 126
+console save 2
+
+# 2. Played to the end, exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/flocking-played.png
+# 5. Paused: `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/flocking-sought.png
+# 7. What a seek shows equals what playing showed.
+expect-same-screenshot .zig-cache/e2e/flocking-played.png .zig-cache/e2e/flocking-sought.png
+console seek 600
+console pause
+frames 10
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live drag (two boids, and the button left down), then the same replay.
+console stop
+down 20 20
+move 30 30
+move 40 40
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/flow_field.reload.script b/examples/noc/test/flow_field.reload.script
new file mode 100644
index 0000000..acad47a
--- /dev/null
+++ b/examples/noc/test/flow_field.reload.script
@@ -0,0 +1,27 @@
+# Live reload keeps State: a new field, a paused replay, the edited build
+# ({v2}: blue vehicles), the same seed and vehicles after it, then play on.
+frames 30
+click 320 180
+frames 30
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect flowfield.seed 2947
+expect vehicles[5].position[0] 595.765 ~0.01
+screenshot .zig-cache/e2e/flow_field-before.png
+frames 1
+load {v2}
+expect flowfield.seed 2947
+expect vehicles[5].position[0] 595.765 ~0.01
+frames 2
+screenshot .zig-cache/e2e/flow_field-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/flow_field-before.png .zig-cache/e2e/flow_field-after.png
+# Unpaused: the replay goes on from where it was.
+console pause
+frames 15
+expect clock.count 86
diff --git a/examples/noc/test/flow_field.script b/examples/noc/test/flow_field.script
new file mode 100644
index 0000000..ceb44ad
--- /dev/null
+++ b/examples/noc/test/flow_field.script
@@ -0,0 +1,15 @@
+# Vehicles settle into the field; space hides the arrows and shows them again;
+# a click makes a new field (a new seed from the generator in State).
+expect flowfield.seed 9503
+frames 90
+key space
+expect debug false
+frames 30
+key space
+expect debug true
+click 320 180
+expect flowfield.seed 2947
+frames 60
+expect vehicles[0].position[0] 168.33 ~0.01
+expect vehicles[0].position[1] 224.94 ~0.01
+screenshot .zig-cache/e2e/flow_field.png
diff --git a/examples/noc/test/flow_field.timeline.script b/examples/noc/test/flow_field.timeline.script
new file mode 100644
index 0000000..0f6242f
--- /dev/null
+++ b/examples/noc/test/flow_field.timeline.script
@@ -0,0 +1,60 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction is space (arrows off and
+# on) and clicks (a new field each, from the generator in State), so a replay
+# must make the same field changes between the same steps.
+
+# 1. Record.
+frames 20
+console snapshot 1
+console record 0
+frames 20
+key space
+frames 15
+click 100 100
+frames 30
+key space
+click 500 300
+frames 30
+console save 2
+
+# 2. Played to the end, exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/flow_field-played.png
+# 5. Paused: `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/flow_field-sought.png
+# 7. What a seek shows equals what playing showed.
+expect-same-screenshot .zig-cache/e2e/flow_field-played.png .zig-cache/e2e/flow_field-sought.png
+console seek 800
+console pause
+frames 10
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live click and key, then the same replay.
+console stop
+click 20 20
+key space
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/fluid_resistance.reload.script b/examples/noc/test/fluid_resistance.reload.script
new file mode 100644
index 0000000..3c44287
--- /dev/null
+++ b/examples/noc/test/fluid_resistance.reload.script
@@ -0,0 +1,32 @@
+# Live reload (design.md "Acceptance: live reload"): play a while, pause a
+# replay so State holds still, load the edited build ({v2}: blue liquid),
+# check that State carried over and the picture changed where the edit shows.
+frames 60
+click 320 180
+frames 60
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect movers[4].position[1] 214.757 ~0.001
+expect movers[4].mass 2.32375 ~0.001
+expect rng.s[0] 539197494011417557
+screenshot .zig-cache/e2e/fluid_resistance-before.png
+frames 1
+load {v2}
+expect movers[4].position[1] 214.757 ~0.001
+expect movers[4].mass 2.32375 ~0.001
+expect rng.s[0] 539197494011417557
+frames 2
+screenshot .zig-cache/e2e/fluid_resistance-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/fluid_resistance-before.png .zig-cache/e2e/fluid_resistance-after.png 0 180 640 180
+# Playing on after the reload: State goes on from where it was.
+console pause
+frames 10
+expect movers[4].position[1] 231.551 ~0.001
+expect movers[4].mass 2.32375 ~0.001
+expect rng.s[0] 539197494011417557
diff --git a/examples/noc/test/fluid_resistance.script b/examples/noc/test/fluid_resistance.script
new file mode 100644
index 0000000..4208882
--- /dev/null
+++ b/examples/noc/test/fluid_resistance.script
@@ -0,0 +1,13 @@
+# Four seconds: the movers have fallen into the liquid and slowed down;
+# the first rests on the floor (360 minus its radius).
+frames 240
+expect movers[0].position[1] 350.94 ~0.01
+expect movers[4].mass 1.0985 ~0.001
+expect movers[4].velocity[1] 0.3603 ~0.001
+# A click starts them over at the top with new masses, and they fall again.
+click 320 180
+expect movers[4].position[1] 0.1 ~0.001
+expect movers[4].mass 2.3238 ~0.001
+frames 80
+expect movers[4].position[1] 229.95 ~0.01
+screenshot .zig-cache/e2e/fluid_resistance.png
diff --git a/examples/noc/test/fluid_resistance.timeline.script b/examples/noc/test/fluid_resistance.timeline.script
new file mode 100644
index 0000000..a8ca2eb
--- /dev/null
+++ b/examples/noc/test/fluid_resistance.timeline.script
@@ -0,0 +1,58 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction is clicks: each starts
+# the movers over with masses from the State's generator, so a replay that
+# missed or doubled a click, or a seek that lost the generator's state,
+# ends elsewhere.
+
+# 1. Record.
+frames 60
+console record 0
+frames 30
+click 100 100
+frames 40
+click 500 300
+frames 30
+# Saving stops the recording first: slot 2 is the state at the stop.
+console save 2
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/fluid_resistance-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/fluid_resistance-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/fluid_resistance-played.png .zig-cache/e2e/fluid_resistance-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/koch.reload.script b/examples/noc/test/koch.reload.script
new file mode 100644
index 0000000..76948a1
--- /dev/null
+++ b/examples/noc/test/koch.reload.script
@@ -0,0 +1,28 @@
+# Live reload keeps State: two clicks, a paused replay, the edited build
+# ({v2}: peaks that point down; the picture is rebuilt because a reload marks it stale), the
+# same generation after it, then the replay plays on to one more click.
+frames 10
+console record 0
+frames 10
+click 320 180
+frames 20
+click 320 180
+frames 10
+console stop
+console play 0
+frames 25
+console pause
+frames 2
+expect generation 6
+screenshot .zig-cache/e2e/koch-before.png
+frames 1
+load {v2}
+expect generation 6
+frames 2
+screenshot .zig-cache/e2e/koch-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/koch-before.png .zig-cache/e2e/koch-after.png
+# Unpaused: the replay goes on from where it was, to the second click.
+console pause
+frames 20
+expect generation 7
diff --git a/examples/noc/test/koch.script b/examples/noc/test/koch.script
new file mode 100644
index 0000000..e658776
--- /dev/null
+++ b/examples/noc/test/koch.script
@@ -0,0 +1,20 @@
+# The book's picture (five generations, 1024 segments), then each click
+# applies the rules once more, and after 8 the curve starts over.
+expect generation 5
+frames 2
+screenshot .zig-cache/e2e/koch.png
+click 320 180
+expect generation 6
+click 320 180
+click 320 180
+expect generation 8
+frames 1
+screenshot .zig-cache/e2e/koch-8.png
+click 320 180
+expect generation 0
+frames 1
+screenshot .zig-cache/e2e/koch-0.png
+click 320 180
+expect generation 1
+frames 1
+screenshot .zig-cache/e2e/koch-1.png
diff --git a/examples/noc/test/koch.timeline.script b/examples/noc/test/koch.timeline.script
new file mode 100644
index 0000000..bb34d46
--- /dev/null
+++ b/examples/noc/test/koch.timeline.script
@@ -0,0 +1,68 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction: clicks, each one more
+# generation. State holds only the generation; the segments are rebuilt in
+# Session when it changes, so the screenshots after a seek or a step
+# check that the derived data follows State.
+
+# 1. Record.
+frames 30
+console record 0
+frames 20
+click 320 180
+frames 20
+click 320 180
+frames 20
+click 320 180
+frames 20
+console save 2
+expect generation 8
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 150
+expect-snapshot 2
+screenshot .zig-cache/e2e/koch-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/koch-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/koch-played.png .zig-cache/e2e/koch-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 150
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+screenshot .zig-cache/e2e/koch-stepped.png
+frames 1
+expect-same-screenshot .zig-cache/e2e/koch-played.png .zig-cache/e2e/koch-stepped.png
+# Back before the last click: the previous generation's picture.
+console step -30
+screenshot .zig-cache/e2e/koch-earlier.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/koch-played.png .zig-cache/e2e/koch-earlier.png
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 150
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/lsystem.reload.script b/examples/noc/test/lsystem.reload.script
new file mode 100644
index 0000000..af37442
--- /dev/null
+++ b/examples/noc/test/lsystem.reload.script
@@ -0,0 +1,28 @@
+# Live reload keeps State: two clicks, a paused replay, the edited build
+# ({v2}: branches at 35° instead of 25°; the picture is rebuilt because a reload marks it stale), the
+# same generation after it, then the replay plays on to one more click.
+frames 10
+console record 0
+frames 10
+click 320 180
+frames 20
+click 320 180
+frames 10
+console stop
+console play 0
+frames 25
+console pause
+frames 2
+expect generation 5
+screenshot .zig-cache/e2e/lsystem-before.png
+frames 1
+load {v2}
+expect generation 5
+frames 2
+screenshot .zig-cache/e2e/lsystem-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/lsystem-before.png .zig-cache/e2e/lsystem-after.png
+# Unpaused: the replay goes on from where it was, to the second click.
+console pause
+frames 20
+expect generation 0
diff --git a/examples/noc/test/lsystem.script b/examples/noc/test/lsystem.script
new file mode 100644
index 0000000..e440b89
--- /dev/null
+++ b/examples/noc/test/lsystem.script
@@ -0,0 +1,16 @@
+# The book's picture: "F" rewritten four times (11 116 characters), drawn
+# by the turtle; each click rewrites once more, and after 5 it starts over.
+expect generation 4
+frames 2
+screenshot .zig-cache/e2e/lsystem.png
+click 320 180
+expect generation 5
+frames 1
+screenshot .zig-cache/e2e/lsystem-5.png
+click 320 180
+expect generation 0
+click 320 180
+click 320 180
+expect generation 2
+frames 1
+screenshot .zig-cache/e2e/lsystem-2.png
diff --git a/examples/noc/test/lsystem.timeline.script b/examples/noc/test/lsystem.timeline.script
new file mode 100644
index 0000000..285900c
--- /dev/null
+++ b/examples/noc/test/lsystem.timeline.script
@@ -0,0 +1,68 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction: clicks, each one more
+# generation. State holds only the generation; the sentence and its picture are rebuilt in
+# Session when it changes, so the screenshots after a seek or a step
+# check that the derived data follows State.
+
+# 1. Record.
+frames 30
+console record 0
+frames 20
+click 320 180
+frames 20
+click 320 180
+frames 20
+click 320 180
+frames 20
+console save 2
+expect generation 1
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 150
+expect-snapshot 2
+screenshot .zig-cache/e2e/lsystem-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/lsystem-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/lsystem-played.png .zig-cache/e2e/lsystem-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 150
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+screenshot .zig-cache/e2e/lsystem-stepped.png
+frames 1
+expect-same-screenshot .zig-cache/e2e/lsystem-played.png .zig-cache/e2e/lsystem-stepped.png
+# Back before the last click: the previous generation's picture.
+console step -30
+screenshot .zig-cache/e2e/lsystem-earlier.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/lsystem-played.png .zig-cache/e2e/lsystem-earlier.png
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 150
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/noise_walker.reload.script b/examples/noc/test/noise_walker.reload.script
new file mode 100644
index 0000000..a426f3b
--- /dev/null
+++ b/examples/noc/test/noise_walker.reload.script
@@ -0,0 +1,31 @@
+# Live reload (design.md "Acceptance: live reload"): play a while, pause a
+# replay so State holds still, load the edited build ({v2}: a light gray
+# circle), check that State carried over and the picture changed where the edit shows.
+# The reload jumps (`in.jumped`), so the whole trail is repainted light.
+frames 120
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect walker.x 343.033 ~0.001
+expect walker.y 75.677 ~0.001
+expect clock.count 130
+screenshot .zig-cache/e2e/noise_walker-before.png
+frames 1
+load {v2}
+expect walker.x 343.033 ~0.001
+expect walker.y 75.677 ~0.001
+expect clock.count 130
+# Playing on: the steps after the reload are drawn by the new code.
+console pause
+frames 10
+expect walker.x 340.456 ~0.001
+expect walker.y 79.168 ~0.001
+expect clock.count 140
+screenshot .zig-cache/e2e/noise_walker-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/noise_walker-before.png .zig-cache/e2e/noise_walker-after.png
+expect-pixel .zig-cache/e2e/noise_walker-after.png 340 79 220 220 220 255
diff --git a/examples/noc/test/noise_walker.script b/examples/noc/test/noise_walker.script
new file mode 100644
index 0000000..b15c60a
--- /dev/null
+++ b/examples/noc/test/noise_walker.script
@@ -0,0 +1,22 @@
+# One second of the walk, saved; four more; then the snapshot loads back.
+# The trail is an offscreen image in Session, so the load (`in.jumped`)
+# repaints it up to the loaded step: the screenshot shows two seconds of
+# trail, not six, and equals a straight two-second run's.
+frames 60
+console save 1
+expect clock.count 60
+expect walker.x 422.59 ~0.01
+expect walker.y 187.75 ~0.01
+frames 240
+console load 1
+expect clock.count 60
+frames 60
+expect clock.count 120
+screenshot .zig-cache/e2e/noise_walker.png
+console reset
+# The console line's frame takes the first step.
+expect clock.count 1
+frames 119
+expect clock.count 120
+screenshot .zig-cache/e2e/noise_walker-straight.png
+expect-same-screenshot .zig-cache/e2e/noise_walker.png .zig-cache/e2e/noise_walker-straight.png
diff --git a/examples/noc/test/noise_walker.timeline.script b/examples/noc/test/noise_walker.timeline.script
new file mode 100644
index 0000000..0c6e417
--- /dev/null
+++ b/examples/noc/test/noise_walker.timeline.script
@@ -0,0 +1,57 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. No input; the walk is noise over time.
+# The trail is drawn from Session (src/trail.zig), so 7. checks that a seek
+# repaints exactly what playing painted.
+
+# 1. Record.
+frames 60
+console record 0
+frames 100
+# Saving stops the recording first: slot 2 is the state at the stop.
+console save 2
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/noise_walker-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/noise_walker-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/noise_walker-played.png .zig-cache/e2e/noise_walker-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+# The seek to the start wiped the trail, and stepping repainted it all:
+# the same picture as playing.
+screenshot .zig-cache/e2e/noise_walker-stepped.png
+expect-same-screenshot .zig-cache/e2e/noise_walker-played.png .zig-cache/e2e/noise_walker-stepped.png
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/path_following.reload.script b/examples/noc/test/path_following.reload.script
new file mode 100644
index 0000000..a8cb61e
--- /dev/null
+++ b/examples/noc/test/path_following.reload.script
@@ -0,0 +1,28 @@
+# Live reload keeps State: a new path, a paused replay, the edited build
+# ({v2}: a blue road), the same path and vehicles after it, then play on.
+frames 30
+click 320 180
+frames 30
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect path[1][0] 117.856 ~0.001
+expect cars[1].position[0] 88.606 ~0.001
+screenshot .zig-cache/e2e/path_following-before.png
+frames 1
+load {v2}
+expect path[1][0] 117.856 ~0.001
+expect cars[1].position[0] 88.606 ~0.001
+frames 2
+screenshot .zig-cache/e2e/path_following-after.png
+frames 1
+# The road changed colour; the vehicles did not move.
+expect-different-screenshot .zig-cache/e2e/path_following-before.png .zig-cache/e2e/path_following-after.png
+# Unpaused: the replay goes on from where it was.
+console pause
+frames 15
+expect clock.count 86
diff --git a/examples/noc/test/path_following.script b/examples/noc/test/path_following.script
new file mode 100644
index 0000000..0a879b5
--- /dev/null
+++ b/examples/noc/test/path_following.script
@@ -0,0 +1,22 @@
+# Two vehicles follow a four-point path; the slower one drifts wider.
+# Space hides the debugging lines; a click makes a new path.
+expect path[1][0] 105.627 ~0.001
+frames 240
+expect cars[0].position[0] 353.657 ~0.001
+expect cars[1].position[1] 239.221 ~0.001
+screenshot .zig-cache/e2e/path_following.png
+key space
+expect debug false
+frames 1
+screenshot .zig-cache/e2e/path_following-plain.png
+click 320 180
+key space
+frames 120
+expect path[2][1] 198.958 ~0.001
+expect cars[1].position[0] 109.937 ~0.001
+# The road is 200 gray everywhere, its round joins included: translucent
+# black drawn once.
+expect-pixel .zig-cache/e2e/path_following-plain.png 105 80 200 200 200 255
+expect-pixel .zig-cache/e2e/path_following-plain.png 420 285 200 200 200 255
+expect-pixel .zig-cache/e2e/path_following-plain.png 110 100 200 200 200 255
+screenshot .zig-cache/e2e/path_following-new.png
diff --git a/examples/noc/test/path_following.timeline.script b/examples/noc/test/path_following.timeline.script
new file mode 100644
index 0000000..4f43163
--- /dev/null
+++ b/examples/noc/test/path_following.timeline.script
@@ -0,0 +1,61 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction: clicks make new paths
+# from the State's generator, and space toggles the debugging lines, so a
+# replay that missed or doubled an input, or a seek that lost the
+# generator's state, ends elsewhere.
+
+# 1. Record.
+frames 60
+console record 0
+frames 30
+click 100 100
+frames 40
+key space
+frames 20
+click 500 300
+key space
+frames 30
+# Saving stops the recording first: slot 2 is the state at the stop.
+console save 2
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 150
+expect-snapshot 2
+screenshot .zig-cache/e2e/path_following-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/path_following-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/path_following-played.png .zig-cache/e2e/path_following-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 150
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 150
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/pendulum.reload.script b/examples/noc/test/pendulum.reload.script
new file mode 100644
index 0000000..292cbfc
--- /dev/null
+++ b/examples/noc/test/pendulum.reload.script
@@ -0,0 +1,26 @@
+# Live reload keeps State: swing, pause a replay so nothing moves, load the
+# edited build ({v2}: a light bob), check State carried over and only the
+# drawing changed, then play on.
+frames 30
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect clock.count 40
+expect angle -0.1696 ~0.001
+screenshot .zig-cache/e2e/pendulum-before.png
+frames 1
+load {v2}
+expect clock.count 40
+expect angle -0.1696 ~0.001
+frames 2
+screenshot .zig-cache/e2e/pendulum-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/pendulum-before.png .zig-cache/e2e/pendulum-after.png
+# Unpaused: the replay goes on from where it was.
+console pause
+frames 20
+expect clock.count 60
diff --git a/examples/noc/test/pendulum.script b/examples/noc/test/pendulum.script
new file mode 100644
index 0000000..244be44
--- /dev/null
+++ b/examples/noc/test/pendulum.script
@@ -0,0 +1,18 @@
+# Grab the bob where it starts (angle PI/4), drag it out to the left, let go.
+down 444 154
+expect dragging true
+move 300 120
+move 200 100
+move 160 60
+frames 2
+expect dragging true
+# The rod points at the pointer: (160, 60) from the pivot (320, 30).
+expect angle -1.3854 ~0.001
+up 160 60
+expect dragging false
+# Let go from rest: one step of gravity since.
+expect angle_velocity 0.0022 ~0.0001
+# It swings back from the left.
+frames 40
+expect angle 0.1588 ~0.001
+screenshot .zig-cache/e2e/pendulum.png
diff --git a/examples/noc/test/pendulum.timeline.script b/examples/noc/test/pendulum.timeline.script
new file mode 100644
index 0000000..11252f2
--- /dev/null
+++ b/examples/noc/test/pendulum.timeline.script
@@ -0,0 +1,68 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction is a drag of the bob and a
+# press that misses it. While dragged, the angle follows the pointer of each
+# frame, so a replay that batched frames or started from other input state
+# would end elsewhere.
+
+# 1. Record, from the start: the bob hangs at PI/4, (444, 154).
+console snapshot 1
+console record 0
+down 444 154
+expect dragging true
+move 400 200
+move 330 220
+frames 5
+move 250 200
+move 160 60
+up 160 60
+frames 40
+# A press away from the bob grabs nothing.
+down 600 300
+move 500 300
+up 500 300
+expect dragging false
+frames 30
+console save 2
+
+# 2. Played to the end, exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/pendulum-played.png
+# 5. Paused: `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/pendulum-sought.png
+# 7. What a seek shows equals what playing showed.
+expect-same-screenshot .zig-cache/e2e/pendulum-played.png .zig-cache/e2e/pendulum-sought.png
+console seek 300
+console pause
+frames 10
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move (and a held button), then the same replay.
+console stop
+move 20 20
+down 20 20
+frames 10
+up 20 20
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/quadtree.reload.script b/examples/noc/test/quadtree.reload.script
new file mode 100644
index 0000000..f842279
--- /dev/null
+++ b/examples/noc/test/quadtree.reload.script
@@ -0,0 +1,30 @@
+# Live reload keeps State: a drag, paused halfway through its replay, the
+# edited build ({v2}: a blue square), the same points after it, then the
+# replay plays on and the drag adds the rest.
+move 200 100
+frames 10
+console record 0
+down 200 100
+frames 30
+up 200 100
+frames 5
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect points.len 2010
+expect points.buffer[2008][0] 198.807 ~0.001
+screenshot .zig-cache/e2e/quadtree-before.png
+frames 1
+load {v2}
+expect points.len 2010
+expect points.buffer[2008][0] 198.807 ~0.001
+frames 2
+screenshot .zig-cache/e2e/quadtree-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/quadtree-before.png .zig-cache/e2e/quadtree-after.png
+# Unpaused: the replay goes on from where it was.
+console pause
+frames 40
+expect points.len 2031
diff --git a/examples/noc/test/quadtree.script b/examples/noc/test/quadtree.script
new file mode 100644
index 0000000..c1dde4f
--- /dev/null
+++ b/examples/noc/test/quadtree.script
@@ -0,0 +1,15 @@
+# 2000 points in a normal cloud, the tree over them, and the points under
+# the pointer's square found through it; then a drag adds points.
+expect points.len 2000
+move 360 200
+frames 2
+screenshot .zig-cache/e2e/quadtree.png
+down 100 80
+move 110 85
+move 120 90
+frames 20
+up 120 90
+expect points.len 2023
+move 120 90
+frames 1
+screenshot .zig-cache/e2e/quadtree-drag.png
diff --git a/examples/noc/test/quadtree.timeline.script b/examples/noc/test/quadtree.timeline.script
new file mode 100644
index 0000000..cc4c3f2
--- /dev/null
+++ b/examples/noc/test/quadtree.timeline.script
@@ -0,0 +1,70 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction: drags, each adding a
+# point a frame near the pointer with offsets from the State's generator,
+# so a replay with the pointer elsewhere, a missed press or a lost
+# generator state ends with other points. The pointer's square is drawn
+# from live input, so the screenshots check that input follows a seek.
+
+# 1. Record.
+move 300 150
+frames 30
+console record 0
+frames 20
+down 300 150
+move 320 160
+frames 10
+move 360 200
+frames 10
+up 360 200
+move 500 250
+frames 20
+down 500 250
+frames 15
+up 500 250
+move 420 120
+frames 20
+# Saving stops the recording first: slot 2 is the state at the stop.
+console save 2
+expect points.len 2039
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 150
+expect-snapshot 2
+screenshot .zig-cache/e2e/quadtree-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/quadtree-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/quadtree-played.png .zig-cache/e2e/quadtree-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 150
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 150
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/random_walk.reload.script b/examples/noc/test/random_walk.reload.script
new file mode 100644
index 0000000..9e60eff
--- /dev/null
+++ b/examples/noc/test/random_walk.reload.script
@@ -0,0 +1,31 @@
+# Live reload (design.md "Acceptance: live reload"): play a while, pause a
+# replay so State holds still, load the edited build ({v2}: red dots),
+# check that State carried over and the picture changed where the edit shows.
+# The reload jumps (`in.jumped`), so the whole trail is repainted, red.
+frames 600
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect walker.x 307
+expect walker.y 157
+expect clock.count 610
+screenshot .zig-cache/e2e/random_walk-before.png
+frames 1
+load {v2}
+expect walker.x 307
+expect walker.y 157
+expect clock.count 610
+# Playing on: the steps after the reload are drawn by the new code too.
+console pause
+frames 10
+expect walker.x 307
+expect walker.y 155
+expect clock.count 620
+screenshot .zig-cache/e2e/random_walk-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/random_walk-before.png .zig-cache/e2e/random_walk-after.png
+expect-pixel .zig-cache/e2e/random_walk-after.png 307 155 255 0 0 255
diff --git a/examples/noc/test/random_walk.script b/examples/noc/test/random_walk.script
new file mode 100644
index 0000000..2bd1900
--- /dev/null
+++ b/examples/noc/test/random_walk.script
@@ -0,0 +1,7 @@
+# Ten seconds of walking (one step behind the frames: the first tick has
+# dt 0).
+frames 600
+expect clock.count 599
+expect walker.x 305
+expect walker.y 160
+screenshot .zig-cache/e2e/random_walk.png
diff --git a/examples/noc/test/random_walk.timeline.script b/examples/noc/test/random_walk.timeline.script
new file mode 100644
index 0000000..3bc8831
--- /dev/null
+++ b/examples/noc/test/random_walk.timeline.script
@@ -0,0 +1,57 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. No input; the walk is the State's
+# generator. The trail is drawn from Session (src/trail.zig), so 7. checks
+# that a seek repaints exactly what playing painted.
+
+# 1. Record.
+frames 60
+console record 0
+frames 100
+# Saving stops the recording first: slot 2 is the state at the stop.
+console save 2
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/random_walk-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/random_walk-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/random_walk-played.png .zig-cache/e2e/random_walk-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+# The seek to the start wiped the trail, and stepping repainted it all:
+# the same picture as playing.
+screenshot .zig-cache/e2e/random_walk-stepped.png
+expect-same-screenshot .zig-cache/e2e/random_walk-played.png .zig-cache/e2e/random_walk-stepped.png
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/recursive_tree.reload.script b/examples/noc/test/recursive_tree.reload.script
new file mode 100644
index 0000000..554d02e
--- /dev/null
+++ b/examples/noc/test/recursive_tree.reload.script
@@ -0,0 +1,26 @@
+# Live reload (design.md "Acceptance: live reload"): play a while, pause a
+# replay so State holds still, load the edited build ({v2}: a green tree), check that
+# State carried over and the picture changed.
+move 480 200
+frames 60
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect angle 1.1781 ~0.0001
+screenshot .zig-cache/e2e/recursive_tree-before.png
+frames 1
+load {v2}
+expect angle 1.1781 ~0.0001
+frames 2
+screenshot .zig-cache/e2e/recursive_tree-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/recursive_tree-before.png .zig-cache/e2e/recursive_tree-after.png
+expect-pixel .zig-cache/e2e/recursive_tree-after.png 319 340 42 122 42 255
+# Playing on after the reload: State goes on from where it was.
+console pause
+frames 10
+expect angle 1.1781 ~0.0001
diff --git a/examples/noc/test/recursive_tree.script b/examples/noc/test/recursive_tree.script
new file mode 100644
index 0000000..c74b0b9
--- /dev/null
+++ b/examples/noc/test/recursive_tree.script
@@ -0,0 +1,22 @@
+# The pointer's x sets the angle between branches: none at the left edge.
+frames 2
+expect angle 0
+screenshot .zig-cache/e2e/recursive_tree-straight.png
+frames 1
+# Every branch stacked on the trunk: one line, 2 px wide, from the bottom
+# to about 300 px up (100 + 67 + 45 + ... until a branch is under 2 px).
+expect-pixel .zig-cache/e2e/recursive_tree-straight.png 319 100 0 0 0 255
+expect-pixel .zig-cache/e2e/recursive_tree-straight.png 320 100 0 0 0 255
+expect-pixel .zig-cache/e2e/recursive_tree-straight.png 321 100 255 255 255 255
+expect-pixel .zig-cache/e2e/recursive_tree-straight.png 320 40 255 255 255 255
+# At three quarters of the width, 3/8 of a turn.
+move 480 200
+frames 2
+expect angle 1.1781 ~0.0001
+screenshot .zig-cache/e2e/recursive_tree.png
+frames 1
+expect-pixel .zig-cache/e2e/recursive_tree.png 319 340 0 0 0 255
+expect-pixel .zig-cache/e2e/recursive_tree.png 321 340 255 255 255 255
+# A slanted branch: its edge pixels are gray, antialiased natively too.
+expect-pixel .zig-cache/e2e/recursive_tree.png 376 235 128 128 128 255 24
+expect-pixel .zig-cache/e2e/recursive_tree.png 379 234 64 64 64 255 24
diff --git a/examples/noc/test/recursive_tree.timeline.script b/examples/noc/test/recursive_tree.timeline.script
new file mode 100644
index 0000000..ec85d74
--- /dev/null
+++ b/examples/noc/test/recursive_tree.timeline.script
@@ -0,0 +1,57 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script: the angle follows the pointer, so each
+# replayed frame must see the pointer its recording saw.
+
+# 1. Record. Input before `record` is the state the recording starts from.
+move 560 300
+console snapshot 1
+console record 0
+frames 30
+move 100 80
+frames 40
+move 400 250
+frames 30
+# Saving stops the recording first: slot 2 is the state at the stop.
+console save 2
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/recursive_tree-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/recursive_tree-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/recursive_tree-played.png .zig-cache/e2e/recursive_tree-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/smoke.reload.script b/examples/noc/test/smoke.reload.script
new file mode 100644
index 0000000..4c69543
--- /dev/null
+++ b/examples/noc/test/smoke.reload.script
@@ -0,0 +1,33 @@
+# Live reload (design.md "Acceptance: live reload"): play a while, pause a
+# replay so State holds still, load the edited build ({v2}: orange smoke), check that
+# State carried over and the picture changed.
+move 480 200
+frames 60
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect clock.count 71
+expect particles.len 51
+expect particles.buffer[0].position[0] 452.977 ~0.001
+expect particles.buffer[0].position[1] 210.788 ~0.001
+screenshot .zig-cache/e2e/smoke-before.png
+frames 1
+load {v2}
+expect clock.count 71
+expect particles.len 51
+expect particles.buffer[0].position[0] 452.977 ~0.001
+expect particles.buffer[0].position[1] 210.788 ~0.001
+frames 2
+screenshot .zig-cache/e2e/smoke-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/smoke-before.png .zig-cache/e2e/smoke-after.png
+# Playing on after the reload: State goes on from where it was.
+console pause
+frames 10
+expect clock.count 81
+expect particles.buffer[0].position[0] 442.620 ~0.001
+expect particles.buffer[0].position[1] 230.923 ~0.001
diff --git a/examples/noc/test/smoke.script b/examples/noc/test/smoke.script
new file mode 100644
index 0000000..93262c9
--- /dev/null
+++ b/examples/noc/test/smoke.script
@@ -0,0 +1,28 @@
+# The pointer at three quarters of the width: a wind of 0.1 to the right.
+move 480 200
+frames 120
+expect wind 0.1 ~0.000001
+# One particle a step, each living 51 steps; the wind piles into the
+# oldest one's velocity.
+expect particles.len 51
+expect particles.buffer[0].lifespan 0
+expect particles.buffer[0].position[0] 480.606 ~0.01
+expect particles.buffer[0].velocity[0] 5.662 ~0.01
+screenshot .zig-cache/e2e/smoke.png
+frames 1
+# The arrow: a 1 px line between rows 49 and 50, half on each.
+expect-pixel .zig-cache/e2e/smoke.png 340 49 127 127 127 255 2
+expect-pixel .zig-cache/e2e/smoke.png 340 50 127 127 127 255 2
+expect-pixel .zig-cache/e2e/smoke.png 300 49 0 0 0 255
+# Faint smoke, densest at the emitter, drifting right; black elsewhere.
+expect-pixel .zig-cache/e2e/smoke.png 320 285 244 244 244 255 3
+expect-pixel .zig-cache/e2e/smoke.png 360 240 54 54 54 255 3
+expect-pixel .zig-cache/e2e/smoke.png 100 100 0 0 0 255
+# The wind to the left: the arrow turns round.
+move 160 200
+frames 2
+expect wind -0.1 ~0.000001
+screenshot .zig-cache/e2e/smoke-left.png
+frames 1
+expect-pixel .zig-cache/e2e/smoke-left.png 300 49 127 127 127 255 2
+expect-pixel .zig-cache/e2e/smoke-left.png 340 49 0 0 0 255
diff --git a/examples/noc/test/smoke.timeline.script b/examples/noc/test/smoke.timeline.script
new file mode 100644
index 0000000..267348d
--- /dev/null
+++ b/examples/noc/test/smoke.timeline.script
@@ -0,0 +1,58 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script: the pointer's x is the wind every step,
+# and the particles' Gaussian draws come from State's generator, so every
+# replay must land on the same particles.
+
+# 1. Record. Input before `record` is the state the recording starts from.
+move 560 300
+console snapshot 1
+console record 0
+frames 30
+move 100 80
+frames 40
+move 400 250
+frames 30
+# Saving stops the recording first: slot 2 is the state at the stop.
+console save 2
+
+# 2. Played to the end (one recorded frame per script frame), exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/smoke-played.png
+# 5. Paused (at the end): `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/smoke-sought.png
+# 7. What a seek shows equals what playing showed (draw-side caches).
+expect-same-screenshot .zig-cache/e2e/smoke-played.png .zig-cache/e2e/smoke-sought.png
+console seek 800
+console pause
+frames 10
+# Paused halfway, then on to the end.
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped: frame by frame from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/system_of_systems.reload.script b/examples/noc/test/system_of_systems.reload.script
new file mode 100644
index 0000000..613d40f
--- /dev/null
+++ b/examples/noc/test/system_of_systems.reload.script
@@ -0,0 +1,33 @@
+# Live reload keeps State: two emitters run, a replay is paused so nothing
+# moves, the edited build ({v2}: red particles) is loaded, and the emitters
+# and their particles carry over; then the replay goes on.
+click 200 100
+frames 60
+click 440 100
+frames 30
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect emitters.len 2
+expect emitters.buffer[0].particles.len 102
+expect emitters.buffer[1].particles.len 42
+expect emitters.buffer[1].particles.buffer[0].position[1] 83.183 ~0.01
+screenshot .zig-cache/e2e/system_of_systems-before.png
+frames 1
+load {v2}
+expect emitters.len 2
+expect emitters.buffer[0].particles.len 102
+expect emitters.buffer[1].particles.len 42
+expect emitters.buffer[1].particles.buffer[0].position[1] 83.183 ~0.01
+frames 2
+screenshot .zig-cache/e2e/system_of_systems-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/system_of_systems-before.png .zig-cache/e2e/system_of_systems-after.png
+# Unpaused: the replay goes on from where it was.
+console pause
+frames 15
+expect emitters.buffer[0].particles.len 117
diff --git a/examples/noc/test/system_of_systems.script b/examples/noc/test/system_of_systems.script
new file mode 100644
index 0000000..91b9fc0
--- /dev/null
+++ b/examples/noc/test/system_of_systems.script
@@ -0,0 +1,18 @@
+# Three emitters, added a while apart; the first fills up to its steady
+# state: a particle lives 128 steps and one is added a step.
+click 160 80
+frames 150
+expect emitters.len 1
+expect emitters.buffer[0].particles.len 128
+click 320 120
+frames 60
+click 480 100
+frames 40
+expect emitters.len 3
+expect emitters.buffer[2].origin[0] 480
+expect emitters.buffer[0].particles.len 128
+expect emitters.buffer[1].particles.len 102
+expect emitters.buffer[2].particles.len 41
+# The oldest particle of a full emitter is about to die.
+expect emitters.buffer[0].particles.buffer[0].lifespan 1
+screenshot .zig-cache/e2e/system_of_systems.png
diff --git a/examples/noc/test/system_of_systems.timeline.script b/examples/noc/test/system_of_systems.timeline.script
new file mode 100644
index 0000000..70b1b59
--- /dev/null
+++ b/examples/noc/test/system_of_systems.timeline.script
@@ -0,0 +1,59 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The interaction is clicks that add
+# emitters; each step draws from the random generator in State, so a replay
+# must make the same clicks between the same steps.
+
+# 1. Record.
+click 100 60
+frames 20
+console snapshot 1
+console record 0
+frames 20
+click 320 100
+frames 30
+click 500 80
+frames 10
+click 250 200
+frames 40
+console save 2
+
+# 2. Played to the end, exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/system_of_systems-played.png
+# 5. Paused: `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/system_of_systems-sought.png
+# 7. What a seek shows equals what playing showed.
+expect-same-screenshot .zig-cache/e2e/system_of_systems-played.png .zig-cache/e2e/system_of_systems-sought.png
+console seek 800
+console pause
+frames 10
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live click (a fifth emitter), then the same replay.
+console stop
+click 20 20
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/the_wave.reload.script b/examples/noc/test/the_wave.reload.script
new file mode 100644
index 0000000..44b9054
--- /dev/null
+++ b/examples/noc/test/the_wave.reload.script
@@ -0,0 +1,26 @@
+# Live reload keeps State: play, pause a replay so nothing moves, load the
+# edited build ({v2}: darker circles), check State carried over and only the
+# drawing changed, then play on.
+frames 60
+console record 0
+frames 30
+console stop
+console play 0
+frames 10
+console pause
+frames 2
+expect clock.count 70
+expect start_angle 1.4 ~0.0001
+screenshot .zig-cache/e2e/the_wave-before.png
+frames 1
+load {v2}
+expect clock.count 70
+expect start_angle 1.4 ~0.0001
+frames 2
+screenshot .zig-cache/e2e/the_wave-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/the_wave-before.png .zig-cache/e2e/the_wave-after.png
+# Unpaused: the replay goes on from where it was.
+console pause
+frames 15
+expect clock.count 85
diff --git a/examples/noc/test/the_wave.script b/examples/noc/test/the_wave.script
new file mode 100644
index 0000000..59f664c
--- /dev/null
+++ b/examples/noc/test/the_wave.script
@@ -0,0 +1,6 @@
+# The wave scrolls by 0.02 rad a 60 Hz step. The first tick has no time
+# behind it (dt 0), so 60 frames make 59 steps.
+frames 60
+expect clock.count 59
+expect start_angle 1.18 ~0.0001
+screenshot .zig-cache/e2e/the_wave.png
diff --git a/examples/noc/test/the_wave.timeline.script b/examples/noc/test/the_wave.timeline.script
new file mode 100644
index 0000000..e35cfcf
--- /dev/null
+++ b/examples/noc/test/the_wave.timeline.script
@@ -0,0 +1,54 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The wave has no input of its own, so the
+# recording is time alone, plus pointer and key events it must ignore.
+
+# 1. Record.
+frames 20
+console snapshot 1
+console record 0
+frames 30
+click 300 200
+key space
+frames 40
+console save 2
+
+# 2. Played to the end, exactly.
+console play 0
+frames 120
+expect-snapshot 2
+screenshot .zig-cache/e2e/the_wave-played.png
+# 5. Paused: `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/the_wave-sought.png
+# 7. What a seek shows equals what playing showed.
+expect-same-screenshot .zig-cache/e2e/the_wave-played.png .zig-cache/e2e/the_wave-sought.png
+console seek 600
+console pause
+frames 10
+console pause
+frames 30
+console pause
+frames 120
+expect-snapshot 2
+
+# 4. Stepped from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -25
+console step 25
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 120
+expect-snapshot 2
+console stop
diff --git a/examples/noc/test/wolfram_ca.reload.script b/examples/noc/test/wolfram_ca.reload.script
new file mode 100644
index 0000000..892ea72
--- /dev/null
+++ b/examples/noc/test/wolfram_ca.reload.script
@@ -0,0 +1,26 @@
+# Live reload keeps State: grow, pause a replay so nothing moves, load the
+# edited build ({v2}: blue cells), check the rows carried over and only the
+# drawing changed, then play on.
+frames 5
+console record 0
+frames 10
+console stop
+console play 0
+frames 5
+console pause
+frames 2
+expect generation 10
+expect rows[2][34] 1
+screenshot .zig-cache/e2e/wolfram_ca-before.png
+frames 1
+load {v2}
+expect generation 10
+expect rows[2][34] 1
+frames 2
+screenshot .zig-cache/e2e/wolfram_ca-after.png
+frames 1
+expect-different-screenshot .zig-cache/e2e/wolfram_ca-before.png .zig-cache/e2e/wolfram_ca-after.png
+# Unpaused: the replay goes on from where it was.
+console pause
+frames 5
+expect generation 15
diff --git a/examples/noc/test/wolfram_ca.script b/examples/noc/test/wolfram_ca.script
new file mode 100644
index 0000000..da7f408
--- /dev/null
+++ b/examples/noc/test/wolfram_ca.script
@@ -0,0 +1,12 @@
+# One generation a step until the canvas is full, then it stops (noLoop).
+# The first tick carries dt 0, so 10 frames are 9 steps.
+frames 10
+expect generation 9
+# Rule 90 from one cell: row 2 is cells 30 and 34, row 3 is 29, 31, 33, 35.
+expect rows[2][30] 1
+expect rows[2][32] 0
+expect rows[3][31] 1
+await generation 33
+frames 30
+expect generation 33
+screenshot .zig-cache/e2e/wolfram_ca.png
diff --git a/examples/noc/test/wolfram_ca.timeline.script b/examples/noc/test/wolfram_ca.timeline.script
new file mode 100644
index 0000000..443d1d7
--- /dev/null
+++ b/examples/noc/test/wolfram_ca.timeline.script
@@ -0,0 +1,56 @@
+# Timeline check (design.md "Acceptance: timeline"), from
+# accel_to_mouse.timeline.script. The automaton takes no input, so the
+# recording is time alone (with pointer and key events it must ignore),
+# made while it is still growing: rows appear at the recorded steps only.
+
+# 1. Record.
+frames 3
+console snapshot 1
+console record 0
+frames 8
+click 300 200
+key space
+frames 10
+console save 2
+expect generation 25
+
+# 2. Played to the end, exactly.
+console play 0
+frames 60
+expect-snapshot 2
+screenshot .zig-cache/e2e/wolfram_ca-played.png
+# 5. Paused: `draw` must not move State.
+frames 30
+expect-snapshot 2
+
+# 3. Sought to the end, and to the middle and played on.
+console seek end
+expect-snapshot 2
+screenshot .zig-cache/e2e/wolfram_ca-sought.png
+# 7. What a seek shows equals what playing showed.
+expect-same-screenshot .zig-cache/e2e/wolfram_ca-played.png .zig-cache/e2e/wolfram_ca-sought.png
+console seek 150
+console pause
+frames 5
+console pause
+frames 5
+console pause
+frames 60
+expect-snapshot 2
+
+# 4. Stepped from the start, then back and forth.
+console seek start
+console step 100000
+expect-snapshot 2
+console step -10
+console step 10
+expect-snapshot 2
+
+# 6. A live pointer move, then the same replay.
+console stop
+move 20 20
+frames 10
+console play 0
+frames 60
+expect-snapshot 2
+console stop