← 65a142eb4d9b · 661dffbdf39a →

65d8d5108df1

A black grid contains a top library of 2–5 connected templates, each in a unique color that serves as its ID. The last three rows contain commands: template ID, transform code (1 identity, 2 clockwise, 3 half-turn, 4 left-right flip, 5 up-down flip, 6 counterclockwise), and output color. Decode nonzero command columns from left to right, crop the named template, transform and recolor it, then stack all pieces horizontally with one black column between them and vertical center alignment.

contact sheet constructionkeyed transformslibrary lookuprecoloring

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-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-hstack-center grids (gap 1)) (if (empty? grids) (list (list)) (let* ((h (apply max (map rows grids))) (w (+ (apply + (map cols grids)) (* gap (- (length grids) 1))))) (let loop ((xs grids) (left 0) (out (empty-grid h w 0))) (if (empty? xs) out (let* ((piece (first xs)) (top (quotient (- h (rows piece)) 2))) (loop (rest xs) (+ left (cols piece) gap) (e8b-paste out piece top left)))))))) (define (s17b-object-crop grid obj) (let ((bb (obj-bbox obj))) (subgrid grid (first bb) (second bb) (third bb) (fourth bb)))) (define (t10b-transform grid code) (cond ((= code 1) grid) ((= code 2) (rotate-cw grid)) ((= code 3) (rotate-180 grid)) ((= code 4) (flip-lr grid)) ((= code 5) (flip-ud grid)) ((= code 6) (rotate-ccw grid)) (else grid))) (define (t10b-recolor grid color) (grid-from-fn (rows grid) (cols grid) (lambda (r c) (if (= (at grid r c) 0) 0 color)))) (let* ((lib (subgrid g 0 0 (- (rows g) 4) (- (cols g) 1))) (ids-row (row g (- (rows g) 3))) (tf-row (row g (- (rows g) 2))) (color-row (row g (- (rows g) 1))) (parts (for/list ((c (in-range (cols g))) #:when (not (= (list-ref ids-row c) 0))) (let* ((tid (list-ref ids-row c)) (obj (first (filter (lambda (obj) (= (obj-color obj) tid)) (objects lib 0)))) (part (s17b-object-crop lib obj)) (transformed (t10b-transform part (list-ref tf-row c)))) (crop-nonzero (t10b-recolor transformed (list-ref color-row c))))))) (f14b-hstack-center parts 1))))

Provenance

Generator
generators/65d8d5108df1/generator.py
Notes and decisions
generators/65d8d5108df1/notes.md
Review label
reviewed_safe
Generator SHA-256
665b7b59c70b957ce6327ca4762eea1c34ac4c7b0301377a7d9543bfd57f0860
Rule hash
d178b58b9106
Sources
bank:ad4abc25f505
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 65d8d5108df1 --count 1 --seed 20261108 --test 1