← 37348ddf20d0 · 3799ce10ce15 →
374fae0ec7a2
Read the two transform codes at the upper left, crop the connected color-9 proto, apply code1 then code2, and stamp the transformed shape centered at each isolated anchor in the anchor's color.
anchor-based stampingrecoloringsame-size constructionsequential transforms
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 dirs4 (list (list -1 0) (list 1 0) (list 0 -1) (list 0 1))) (define (binary-grid grid) (grid-from-fn (rows grid) (cols grid) (lambda (r c) (if (= (at grid r c) 0) 0 1)))) (define (paste-crop grid shape top left) (for*/fold ((out grid)) ((r (in-range (rows shape))) (c (in-range (cols shape)))) (let ((v (at shape 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 (components-any-nonzero grid) (let loop-pos ((positions (grid-positions grid)) (seen (list)) (acc (list))) (cond ((empty? positions) (reverse acc)) ((or (member? (first positions) seen) (= (at grid (first (first positions)) (second (first positions))) 0)) (loop-pos (rest positions) seen acc)) (else (let bfs ((queue (list (first positions))) (seen2 (cons (first positions) seen)) (cells (list))) (if (empty? queue) (loop-pos (rest positions) seen2 (cons (sort cells cell<) acc)) (let* ((cur (first queue)) (nbrs (filter (lambda (p) (and (in-bounds? (first p) (second p) (rows grid) (cols grid)) (not (member? p seen2)) (not (= (at grid (first p) (second p)) 0)))) (map (lambda (d) (list (+ (first cur) (first d)) (+ (second cur) (second d)))) dirs4)))) (bfs (append (rest queue) nbrs) (append seen2 nbrs) (cons cur cells))))))))) (define (component-grid-cells grid cells) (let* ((bb (bbox-of-cells cells)) (h (+ 1 (- (third bb) (first bb)))) (w (+ 1 (- (fourth bb) (second bb))))) (for/fold ((out (empty-grid h w 0))) ((p (in-list cells))) (set-cell out (- (first p) (first bb)) (- (second p) (second bb)) (at grid (first p) (second p)))))) (define (recolor-grid grid color) (grid-from-fn (rows grid) (cols grid) (lambda (r c) (if (= (at grid r c) 0) 0 color)))) (define (apply-code1 grid code) (cond ((= code 1) grid) ((= code 2) (flip-lr grid)) ((= code 3) (flip-ud grid)) ((= code 4) (rotate-cw grid)) ((= code 5) (rotate-180 grid)) ((= code 6) (rotate-ccw grid)) (else grid))) (define (component-colors grid cells) (remove-duplicates (map (lambda (p) (at grid (first p) (second p))) cells))) (let* ((code1 (at g 0 0)) (code2 (at g 0 1)) (gg (set-cell (set-cell g 0 0 0) 0 1 0)) (components (components-any-nonzero gg)) (proto-cells (first (filter (lambda (cells) (member? 9 (component-colors gg cells))) components))) (anchors (filter (lambda (cells) (and (= (length cells) 1) (not (member? 9 (component-colors gg cells))))) components)) (proto (binary-grid (component-grid-cells gg proto-cells))) (shape (apply-code1 (apply-code1 proto code1) code2)) (ph (rows shape)) (pw (cols shape))) (for/fold ((out (empty-grid (rows g) (cols g) 0))) ((anchor-cells (in-list anchors))) (let* ((p (first anchor-cells)) (color (at gg (first p) (second p))) (tile (recolor-grid shape color)) (top (- (first p) (quotient ph 2))) (left (- (second p) (quotient pw 2)))) (paste-crop out tile top left))))))
Provenance
- Generator
- generators/374fae0ec7a2/generator.py
- Notes and decisions
- generators/374fae0ec7a2/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- 3542010815c2e0504e11a947ca2fc7c6ba0fbdff1fbfb90034cd0d5334ef9eab
- Rule hash
- 664609196c7e
- Sources
- bank:01130745873d
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate 374fae0ec7a2 --count 1 --seed 20261108 --test 1