From 1b87e20543ca4577b855b3abf705561e9b45add8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 02:31:55 -0300 Subject: 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- addons/snake/snake.script | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 addons/snake/snake.script (limited to 'addons/snake/snake.script') 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 -- cgit v1.3