summaryrefslogtreecommitdiff
path: root/examples/noc/test/bin_lattice.script
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/bin_lattice.script
parent82fca5c9f29124f37f6dcd08e73e6999ce44a69d (diff)
downloadsketchbook-6933f99ddb2d7103515d26838496309a807bba26.tar.gz
sketchbook-6933f99ddb2d7103515d26838496309a807bba26.zip
Move standalone sketches into sketchbook examples
Diffstat (limited to 'examples/noc/test/bin_lattice.script')
-rw-r--r--examples/noc/test/bin_lattice.script32
1 files changed, 32 insertions, 0 deletions
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