(define seed
'((1 . 1) (2 . 2) (0 . 3) (1 . 3) (2 . 3)
(7 . 1) (8 . 1) (9 . 1)
(8 . 0) (8 . 2)
(14 . 2) (15 . 2) (16 . 2)
(14 . 3) (16 . 3)
(14 . 4) (15 . 4) (16 . 4)
(4 . 8) (5 . 8) (6 . 8) (7 . 8)
(4 . 9) (7 . 9)
(4 . 10) (5 . 10) (6 . 10) (7 . 10)
(11 . 8) (12 . 8) (13 . 8)
(12 . 9)
(11 . 10) (12 . 10) (13 . 10)
(16 . 10) (17 . 10)
(16 . 11) (17 . 11)
(2 . 12) (3 . 12) (4 . 12)
(3 . 13)))(define (same-point? a b)
(and (= (car a) (car b))
(= (cdr a) (cdr b))))(define (alive? p world)
(if (null? world)
#f
(if (same-point? p (car world))
#t
(alive? p (cdr world)))))(define (neighbors p)
(let ((x (car p)) (y (cdr p)))
(list
(cons (- x 1) (- y 1)) (cons x (- y 1)) (cons (+ x 1) (- y 1))
(cons (- x 1) y) (cons (+ x 1) y)
(cons (- x 1) (+ y 1)) (cons x (+ y 1)) (cons (+ x 1) (+ y 1)))))(define (count-living p world)
(let loop ((ns (neighbors p)) (n 0))
(if (null? ns) n
(loop (cdr ns) (if (alive? (car ns) world) (+ n 1) n)))))(define (dedupe lst)
(if (null? lst) '()
(if (member (car lst) (cdr lst))
(dedupe (cdr lst))
(cons (car lst) (dedupe (cdr lst))))))(define (candidates world)
(let loop ((w world) (acc '()))
(if (null? w) (dedupe acc)
(loop (cdr w) (cons (car w) (append (neighbors (car w)) acc))))))(define (will-live? p world)
(let ((n (count-living p world)))
(if (alive? p world)
(or (= n 2) (= n 3))
(= n 3)))) (define (tick world)
(let loop ((cs (candidates world)) (next '()))
(if (null? cs) next
(loop (cdr cs)
(if (will-live? (car cs) world)
(cons (car cs) next)
next)))))(define (cell->text p world)
(if (alive? p world) "# " ". "))(define (draw-row world y x w)
(if (= x w)
"\n"
(string-append
(cell->text (cons x y) world)
(draw-row world y (+ x 1) w))))(define (draw-frame world w h)
(let loop-y ((y 0) (out ""))
(if (= y h)
out
(loop-y (+ y 1)
(string-append out (draw-row world y 0 w))))))(define (in-bounds? p w h)
(and (>= (car p) 0)
(< (car p) w)
(>= (cdr p) 0)
(< (cdr p) h)))(define (candidates-bounded world w h)
(let loop ((cs (candidates world)) (out '()))
(if (null? cs)
out
(loop (cdr cs)
(if (in-bounds? (car cs) w h)
(cons (car cs) out)
out)))))(define (tick-bounded world w h)
(let loop ((cs (candidates-bounded world w h)) (next '()))
(if (null? cs)
next
(loop (cdr cs)
(if (will-live? (car cs) world)
(cons (car cs) next)
next)))))(define (life-frames world n w h)
(let loop ((world world) (remaining n) (frames '()))
(let ((frame (draw-frame world w h)))
(if (= remaining 0)
(reverse (cons frame frames))
(loop (tick-bounded world w h)
(- remaining 1)
(cons frame frames))))))(animate (life-frames seed 40 20 15) 500)This site is a kind of personal computing tool built in the lineage of Notion and Jupyter notebooks: a system of blocks for thinking, connecting, writing, and coding all in one. Think of it like the eccentric notebook of a designer, where each page is an expression of my curiosity—rather than expertise.