← 20b53e0c4957 · 21d822423cfc →
20b5e7246250
Two hollow gray rectangular frames each have one distinct colored key cell directly above them. Elsewhere are two connected source motifs, one in each key color. Match by color, normalize each source motif, and center it inside the corresponding frame. The output is rebuilt on a zero background: frames and centered copies remain; original keys and source motifs are removed.
framesinsertionmatching
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 (obj< a b) (let ((ba (obj-bbox a)) (bb (obj-bbox b))) (if (= (first ba) (first bb)) (< (second ba) (second bb)) (< (first ba) (first bb))))) (define (bbox-h bb) (+ 1 (- (third bb) (first bb)))) (define (bbox-w bb) (+ 1 (- (fourth bb) (second bb)))) (define (rect-frame? grid obj) (let* ((bb (obj-bbox obj)) (r1 (first bb)) (c1 (second bb)) (r2 (third bb)) (c2 (fourth bb)) (h (bbox-h bb)) (w (bbox-w bb)) (color (obj-color obj)) (perim (- (+ (* 2 h) (* 2 w)) 4))) (and (= color 5) (>= h 3) (>= w 3) (= (obj-size obj) perim) (all? (lambda (c) (= (at grid r1 c) 5)) (range c1 (+ c2 1))) (all? (lambda (c) (= (at grid r2 c) 5)) (range c1 (+ c2 1))) (all? (lambda (r) (= (at grid r c1) 5)) (range r1 (+ r2 1))) (all? (lambda (r) (= (at grid r c2) 5)) (range r1 (+ r2 1)))))) (define (object-grid obj (grid #f)) (if grid (subgrid grid (obj-r1 obj) (obj-c1 obj) (obj-r2 obj) (obj-c2 obj)) (paint-cells (empty-grid (obj-h obj) (obj-w obj) 0) (normalize-cells (obj-cells obj)) (obj-color obj)))) (define (stamp-grid-nonzero out sub tr tc) (foldl (lambda (cell acc) (let ((r (+ tr (first cell))) (c (+ tc (second cell))) (v (third cell))) (if (and (not (= v 0)) (in-bounds? r c (rows acc) (cols acc))) (set-cell acc r c v) acc))) out (grid-cells sub))) (define frames (sort (filter (lambda (o) (rect-frame? g o)) (objects g 0)) obj<)) (define (key-for frame) (let* ((bb (obj-bbox frame)) (r (- (first bb) 1)) (cs (range (second bb) (+ (fourth bb) 1))) (vals (filter (lambda (c) (and (>= r 0) (not (= (at g r c) 0)))) cs))) (if (empty? vals) 0 (at g r (first vals))))) (define (source-for color) (first (sort (filter (lambda (o) (and (= (obj-color o) color) (> (obj-size o) 1))) (objects g 0)) obj<))) (for/fold ((out (for/fold ((blank (empty-grid (rows g) (cols g) 0))) ((f (in-list frames))) (paint-cells blank (obj-cells f) 5)))) ((frame (in-list frames))) (let* ((key (key-for frame)) (src (source-for key)) (sub (object-grid src)) (bb (obj-bbox frame)) (ih (- (third bb) (first bb) 1)) (iw (- (fourth bb) (second bb) 1)) (tr (+ (first bb) 1 (quotient (- ih (rows sub)) 2))) (tc (+ (second bb) 1 (quotient (- iw (cols sub)) 2)))) (stamp-grid-nonzero out sub tr tc)))))
Provenance
- Generator
- generators/20b5e7246250/generator.py
- Notes and decisions
- generators/20b5e7246250/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- adc6442536468f1ee47274a4f2aea1bd244e00fdca974be89e209bb912bcc2c1
- Rule hash
- 42dd98d10175
- Sources
- bank:1cd6e373f225
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate 20b5e7246250 --count 1 --seed 20261108 --test 1