← 4e4fa6c8d4ce · 4e6862c442fd →
4e53f3cd64e8
Separated top-row legend plus one crop-sized component per legend color.
component lookup by colorexternal key rowgallery packing
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 (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 (e5b-nz-components 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 (reverse cells) 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 (s17b-gallery-row objs (gap 1)) (if (empty? objs) (list (list 0)) (let* ((h (apply max (map rows objs))) (w (+ (apply + (map cols objs)) (* gap (- (length objs) 1))))) (let loop ((rest-objs objs) (left 0) (out (empty-grid h w 0))) (if (empty? rest-objs) out (let ((obj (first rest-objs))) (loop (rest rest-objs) (+ left (cols obj) gap) (e8b-paste out obj 0 left)))))))) (define (s6-component-grid grid cells) (let ((bb (bbox-of-cells cells))) (grid-from-fn (+ 1 (- (third bb) (first bb))) (+ 1 (- (fourth bb) (second bb))) (lambda (r c) (let ((rr (+ (first bb) r)) (cc (+ (second bb) c))) (if (member? (list rr cc) cells) (at grid rr cc) 0)))))) (define (s6b-component-crop grid cells) (s6-component-grid grid cells)) (let* ((legend (filter (lambda (v) (not (= v 0))) (first g))) (body (subgrid g 2 0 (- (rows g) 1) (- (cols g) 1))) (parts (for/list ((color (in-list legend))) (let ((cells (first (filter (lambda (comp) (= (at body (first (first comp)) (second (first comp))) color)) (e5b-nz-components body))))) (s6b-component-crop body cells))))) (s17b-gallery-row parts 1))))
Provenance
- Generator
- generators/4e53f3cd64e8/generator.py
- Notes and decisions
- generators/4e53f3cd64e8/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- 1037a8625fb543c21cf04d37f41eca4a9d270a970b852e11c172f0d02240be5f
- Rule hash
- 5bdc8d1d0941
- Sources
- bank:529ce7614691
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate 4e53f3cd64e8 --count 1 --seed 20261108 --test 1