{ "cells": [ { "cell_type": "markdown", "id": "q2x236nvt0d", "metadata": {}, "source": [ "# KidLisp Cards — Visual Preview\n", "\n", "Tiny koans of KidLisp wisdom. Each program is 2-4 lines and produces a static pattern.\n", "\n", "This notebook renders each card using a minimal Python KidLisp interpreter (PIL-based) so we can see the output instantly and curate the best ones for the card deck." ] }, { "cell_type": "code", "execution_count": 1, "id": "er6d68jtzz6", "metadata": { "execution": { "iopub.execute_input": "2026-03-15T00:37:48.225489Z", "iopub.status.busy": "2026-03-15T00:37:48.223257Z", "iopub.status.idle": "2026-03-15T00:37:48.332264Z", "shell.execute_reply": "2026-03-15T00:37:48.330180Z" } }, "outputs": [], "source": [ "import sys, os; sys.path.insert(0, os.path.join(os.getcwd(), \"notebooks\") if not os.getcwd().endswith(\"notebooks\") else os.getcwd())\n", "from ac import show_card" ] }, { "cell_type": "markdown", "id": "s6ssh45ry6", "metadata": {}, "source": [ "## Lines" ] }, { "cell_type": "code", "execution_count": 2, "id": "7sgh977d8vd", "metadata": { "execution": { "iopub.execute_input": "2026-03-15T00:37:48.341514Z", "iopub.status.busy": "2026-03-15T00:37:48.340438Z", "iopub.status.idle": "2026-03-15T00:37:48.488791Z", "shell.execute_reply": "2026-03-15T00:37:48.483075Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
(wipe black)\n",
"(ink white)\n",
"(repeat 72 i (line 80 60 (+ 80 (* 55 (cos (* i 0.087)))) (+ 60 (* 55 (sin (* i 0.087))))))\n",
" (wipe white)\n",
"(ink 0 0 0 40)\n",
"(repeat 40 i (line (* i 4) 0 (* i 4) 120))\n",
"(repeat 40 i (line 0 (* i 3) 160 (* i 3)))\n",
" (wipe navy)\n",
"(ink cyan)\n",
"(repeat 30 i (line 0 (* i 4) 160 60))\n",
"(repeat 30 i (line 160 (* i 4) 0 60))\n",
" (wipe black)\n",
"(ink lime)\n",
"(repeat 50 i (line 0 (* i 2.4) (* i 3.2) 0))\n",
"(repeat 50 i (line 160 (- 120 (* i 2.4)) (- 160 (* i 3.2)) 120))\n",
" (wipe black)\n",
"(outline)\n",
"(repeat 30 i (ink 0 (* i 8) 255) (circle 80 60 (* i 4)))\n",
" (wipe white)\n",
"(ink black)\n",
"(repeat 10 y (repeat 10 x (circle (+ 12 (* x 16)) (+ 10 (* y 12)) 3)))\n",
" (wipe white)\n",
"(repeat 8 i (if (% i 2) (ink red) (ink white)) (circle 80 60 (- 64 (* i 8))))\n",
" (wipe navy)\n",
"(ink yellow)\n",
"(circle 80 60 40)\n",
"(ink navy)\n",
"(circle 90 55 38)\n",
" (wipe white)\n",
"(ink red) (box 5 5 50 40)\n",
"(ink blue) (box 60 50 100 65)\n",
"(ink yellow) (box 5 50 50 30)\n",
"(ink black) (stroke 3) (outline) (box 5 5 155 115)\n",
" (resolution 16 12)\n",
"(repeat 12 y (repeat 16 x (ink (* x 16) (* y 20) 128) (box x y 1 1)))\n",
" (wipe black)\n",
"(repeat 10 i (ink (* i 25) 100 (- 255 (* i 25))) (box (* i 7) (* i 5) (- 160 (* i 14)) (- 120 (* i 10))))\n",
" (wipe black)\n",
"(repeat 8 i (ink (% (* i 50) 256) (% (* i 80) 256) (% (* i 110) 256)) (box (* i 20) 0 20 120))\n",
" (wipe white)\n",
"(ink navy)\n",
"(repeat 160 x (plot x (+ 60 (* 40 (sin (* x 0.05))))))\n",
" (wipe black)\n",
"(ink lime)\n",
"(repeat 600 t (plot (+ 80 (* 60 (sin (* t 0.03)))) (+ 60 (* 50 (cos (* t 0.02))))))\n",
" (wipe black)\n",
"(ink white)\n",
"(repeat 500 t (plot (+ 80 (* (/ t 10) (cos (* t 0.1)))) (+ 60 (* (/ t 10) (sin (* t 0.1))))))\n",
" (wipe black)\n",
"(repeat 6 y (repeat 8 x (ink (* x 30) (* y 40) 200) (circle (+ 10 (* x 20) (* (% y 2) 10)) (+ 12 (* y 20)) 9)))\n",
" (resolution 160 1)\n",
"(repeat 160 x (ink x (* 1.5 (abs (- x 80))) (- 255 x)) (box x 0 1 1))\n",
" (resolution 32 24)\n",
"(repeat 24 y (repeat 32 x (ink (* x 8) (* y 10) 128) (plot x y)))\n",
" (wipe black)\n",
"(repeat 8 i (ink (* i 30) 100 255) (tri 0 (* i 15) 80 (+ 10 (* i 15)) 160 (* i 15)))\n",
" (wipe black)\n",
"(ink white)\n",
"(repeat 128 y (repeat 128 x (if (= 0 (& x y)) (plot (+ 16 x) y))))\n",
" (wipe white)\n",
"(ink 0 0 0 60)\n",
"(repeat 80 i (circle 60 60 (* i 2)))\n",
"(repeat 80 i (circle 100 60 (* i 2)))\n",
" (wipe white)\n",
"(repeat 16 i (ink 200 0 0 50) (box (* i 10) 0 5 120))\n",
"(repeat 12 i (ink 0 0 200 50) (box 0 (* i 10) 160 5))\n",
" (wipe black)\n",
"(repeat 500 i\n",
" (ink (* (% i 8) 32) (+ 100 (% (* i 7) 155)) (* (% i 5) 50))\n",
" (plot (+ 80 (* (* i 0.1) (cos (* i 2.4)))) (+ 60 (* (* i 0.1) (sin (* i 2.4))))))\n",
" (wipe black)\n",
"(repeat 120 y (repeat 160 x\n",
" (if (= 0 (% (+ (* x x) (* y y)) 17))\n",
" (do (ink 255 255 255) (plot x y)))))\n",
" (wipe navy)\n",
"(ink gold)\n",
"(box 0 70 160 50)\n",
" (wipe black)\n",
"(ink red)\n",
"(circle 80 60 4)\n",
" (wipe white)\n",
"(ink black)\n",
"(box 75 20 10 80)\n",
"(box 40 50 80 10)\n",
" (wipe black)\n",
"(ink cyan)\n",
"(line 0 0 160 120)\n",
"(ink magenta)\n",
"(line 160 0 0 120)\n",
" (wipe black)\n",
"(ink white)\n",
"(repeat 4 i (crawl 40) (right 90))\n",
" (wipe navy)\n",
"(ink yellow)\n",
"(repeat 5 i (crawl 50) (right 144))\n",
" (wipe black)\n",
"(ink cyan)\n",
"(repeat 100 i (crawl (* i 0.5)) (right 30))\n",
" (wipe black)\n",
"(ink magenta)\n",
"(repeat 6 i (crawl 30) (right 60))\n",
" (wipe navy)\n",
"(ink white)\n",
"(repeat 6 i\n",
" (repeat 3 j (crawl 20) (right 60) (crawl 20) (left 120))\n",
" (right 60))\n",
" (wipe black)\n",
"(repeat 36 i\n",
" (ink (* i 7) 128 255)\n",
" (goto 80 60) (face (* i 10))\n",
" (crawl 40) (right 90) (crawl 15) (right 90) (crawl 15))\n",
" (wipe black)\n",
"(ink green) (goto 80 110) (face 270)\n",
"(later branch len\n",
" (if (> len 3)\n",
" (do (crawl len) (left 30) (branch (* len 0.7))\n",
" (right 60) (branch (* len 0.7)) (left 30)\n",
" (up) (crawl (- 0 len)) (down))))\n",
"(branch 35)\n",
" (wipe white)\n",
"(ink coral) (goto 10 60) (face 0)\n",
"(repeat 15 i\n",
" (crawl 10) (if (% i 2) (right 120) (left 120)))\n",
"