summaryrefslogtreecommitdiff
path: root/addons/snake/snake.script
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 02:31:55 -0300
committerGabriel Schneider <[email protected]>2026-11-06 04:04:25 -0300
commit1b87e20543ca4577b855b3abf705561e9b45add8 (patch)
tree3ac89cb20ce76090639c08eaacbf454fcf733e50 /addons/snake/snake.script
parent9c66cdc9049b49f128336dcf5046e2bb1321e281 (diff)
downloadpardes-1b87e20543ca4577b855b3abf705561e9b45add8.tar.gz
pardes-1b87e20543ca4577b855b3abf705561e9b45add8.zip
kinds #6, the snake: addons/snake/snake.c (153 lines) against ABI 2 steps only while its pane has the keyboard and asks for nothing otherwise (19 lines of boilerplate, 13 by §16.7's measure: the head, word and ops literal, the api kept, an alloc check and two of prefix; the body pair and open's unused arguments are the rest), built by the build with -Wall -Wextra -Werror and not installed, and addon-test runs it against addons/snake/snake.out: its moves, h j k l turns and no turning back, food, the ctl read and body, blur with settle asking for no ticks and the snake still, focus resuming, a dump into a fresh pane, death on the wall and a restart
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'addons/snake/snake.script')
-rw-r--r--addons/snake/snake.script37
1 files changed, 37 insertions, 0 deletions
diff --git a/addons/snake/snake.script b/addons/snake/snake.script
new file mode 100644
index 00000000..2cf07a51
--- /dev/null
+++ b/addons/snake/snake.script
@@ -0,0 +1,37 @@
+# pardes --addon-test snake.so addons/snake/snake.script | diff addons/snake/snake.out -
+seed 3
+size 40 30
+# It steps a cell each 150 ms while its pane has the keyboard (the first
+# tick sets the pace).
+tick 150
+tick 150
+# k turns it up, l right: onto the food, one longer and a point.
+key k
+tick 150
+key l
+tick 150
+tick 150
+# h is back on itself: refused, it goes on right; then j down.
+key h
+tick 150
+key j
+tick 150
+ctl
+body
+# The window loses the keyboard: it stands still and asks for no ticks.
+blur
+settle
+tick 600
+# Back, it goes on, the first tick setting its pace again.
+focus
+tick 150
+tick 150
+# Its record is its state: the pane comes back from it as it was.
+dump
+tick 150
+# Into the bottom wall: over, asking for nothing until a key starts it again.
+tick 150
+tick 150
+settle
+key x
+tick 150