← 27a915a2c9b3 · 27bc4c66eed7 →

27b865c5f43a

Three distinct isolated shapes are ordered left-to-right, binary-cropped, top-left padded to 3x3, and expanded into a color-8 ordered pairwise-OR gallery with one-cell separators.

boolean shape operationsgallery layoutpairwise construction

Generated by the released generator before publication; every output was computed by its Racket reference rule. White outlines mark the cells the rule changed. Lesson check:

refuted: a demonstration contradicts the rival. survived_all: it fits every demonstration and also gives the intended answer, so it cannot mislead here. ambiguous: it fits every demonstration but answers the query differently. Names are as declared by the generator; a declared shortcut is not guaranteed to fit the original pairs (see the paper’s Limitations).

Original task pairs

From the source task; the reference rule must reproduce them.

Reference rule (Racket)

(rule! (let ((dummy 0)) (define (nonzero-cells grid) (filter (lambda (p) (not (= (at grid (first p) (second p)) 0))) (grid-positions grid))) (define (crop-nonzero grid) (let ((cells (nonzero-cells grid))) (if (empty? cells) (list (list 0)) (let* ((bb (bbox-of-cells cells))) (subgrid grid (first bb) (second bb) (third bb) (fourth bb)))))) (define (e8b-list< a b) (cond ((empty? a) #f) ((< (first a) (first b)) #t) ((> (first a) (first b)) #f) (else (e8b-list< (rest a) (rest b))))) (define (e8b-paste grid pat top left) (for*/fold ((out grid)) ((r (in-range (rows pat))) (c (in-range (cols pat)))) (let ((v (at pat r c)) (rr (+ top r)) (cc (+ left c))) (if (and (not (= v 0)) (in-bounds? rr cc (rows out) (cols out))) (set-cell out rr cc v) out)))) (define (f14b-binary-crop grid) (crop-nonzero (grid-from-fn (rows grid) (cols grid) (lambda (r c) (if (= (at grid r c) 0) 0 1))))) (define (s17b-object-crop grid obj) (let ((bb (obj-bbox obj))) (subgrid grid (first bb) (second bb) (third bb) (fourth bb)))) (define (s17b-object-col< a b) (let ((ba (obj-bbox a)) (bb (obj-bbox b))) (e8b-list< (list (second ba) (first ba)) (list (second bb) (first bb))))) (define (s17b-pad-top-left grid h w) (e8b-paste (empty-grid h w 0) grid 0 0)) (define (s17b-gallery-grid panel-rows (gap 1)) (let* ((all-panels (apply append panel-rows)) (ph (apply max (map rows all-panels))) (pw (apply max (map cols all-panels))) (nr (length panel-rows)) (nc (length (first panel-rows))) (out-h (+ (* nr ph) (* gap (- nr 1)))) (out-w (+ (* nc pw) (* gap (- nc 1))))) (for*/fold ((out (empty-grid out-h out-w 0))) ((rr (in-range nr)) (cc (in-range nc))) (e8b-paste out (list-ref (list-ref panel-rows rr) cc) (* rr (+ ph gap)) (* cc (+ pw gap)))))) (let* ((objs (map (lambda (obj) (f14b-binary-crop (s17b-object-crop g obj))) (sort (objects g 0) s17b-object-col<))) (ph (apply max (map rows objs))) (pw (apply max (map cols objs))) (padded (map (lambda (obj) (s17b-pad-top-left obj ph pw)) objs))) (s17b-gallery-grid (for/list ((a (in-list padded))) (for/list ((b (in-list padded))) (grid-from-fn ph pw (lambda (r c) (if (or (not (= (at a r c) 0)) (not (= (at b r c) 0))) 8 0))))) 1))))

Provenance

Generator
generators/27b865c5f43a/generator.py
Notes and decisions
generators/27b865c5f43a/notes.md
Review label
reviewed_safe
Generator SHA-256
495ba0e0517cf001c44dfcd69c0ca56e98e4bc767fdcfd76e56e726424be377e
Rule hash
de4d9d03f710
Sources
bank:f716aa11d181
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 27b865c5f43a --count 1 --seed 20261108 --test 1