← 341758fa9de1 · 346480121fcb →
34569d6118b3
Pair ordered color swatches with ordered gray masks, then expand a lower color layout through those masks.
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! (lambda (g)
(let* ((h (rows g))
(w (cols g))
(first-empty-row (let loop
((r 0))
(cond
((>= r h) h)
((for/and ((c (range 0 w))) (zero? (at g r c))) r)
(else (loop (+ r 1))))))
(top-h first-empty-row)
(runs (let loop
((cx 0) (acc (list)))
(cond
((>= cx w) (reverse acc))
((zero? (at g 0 cx)) (loop (+ cx 1) acc))
(else (let* ((run-color (at g 0 cx))
(run-end (let find-end
((cc cx))
(cond
((>= cc w) cc)
((zero? (at g 0 cc)) cc)
(else (find-end (+ cc 1)))))))
(loop run-end
(cons (list cx (- run-end 1) run-color) acc)))))))
(swatches (filter (lambda (r) (!= (third r) 5)) runs))
(template-bounds (filter (lambda (r) (= (third r) 5)) runs))
(template-mats (for/list ((tb template-bounds))
(let* ((cs (first tb))
(ce (second tb)))
(for/list ((r (range 0 top-h)))
(for/list ((cx (range cs (+ ce 1)))) (at g r cx))))))
(swatch-colors (map third swatches))
(color-to-template (make-hash)))
(for ((i (range 0 (length swatch-colors))))
(hash-set! color-to-template
(list-ref swatch-colors i)
(list-ref template-mats i)))
(let* ((layout-cells (for*/list ((r (range first-empty-row h)) (cx (range 0 w))
#:when
(!= (at g r cx) 0))
(list r cx)))
(layout-rs (map first layout-cells))
(layout-cs (map second layout-cells))
(l-r1 (min-list layout-rs))
(l-r2 (max-list layout-rs))
(l-c1 (min-list layout-cs))
(l-c2 (max-list layout-cs))
(layout-h (+ 1 (- l-r2 l-r1)))
(layout-w (+ 1 (- l-c2 l-c1)))
(tmpl-h top-h)
(tmpl-w (+ 1
(- (second (first template-bounds))
(first (first template-bounds))))))
(build-grid (* layout-h tmpl-h)
(* layout-w tmpl-w)
(r c)
(let* ((lr (quotient r tmpl-h))
(lc (quotient c tmpl-w))
(tr (remainder r tmpl-h))
(tc (remainder c tmpl-w))
(layout-color (at g (+ l-r1 lr) (+ l-c1 lc)))
(template (hash-ref color-to-template layout-color))
(tmpl-val (list-ref (list-ref template tr) tc)))
(casev tmpl-val (hash 5 layout-color) 0)))))))Provenance
- Generator
- generators/34569d6118b3/generator.py
- Notes and decisions
- generators/34569d6118b3/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- f61a4b88290f3c23cb001c42ae36f4fad9f9fa0f3ae3e491efbd9f3a26c6f409
- Rule hash
- e2b81b5e525c
- Sources
- augmented, training
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate 34569d6118b3 --count 1 --seed 20261108 --test 1