← 6c5bf76aa982 · 6c894e4b9bf5 →
6c68e1b008a5
Infer an onion-depth palette from panels 1-2, recolor panel 3, and mark the matching candidate.
analogy, palette inference, candidate selection, panel reasoning
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!
;; Panels split by maroon(9) columns. Panels 1+2 are a PLAIN/COLORED
;; pair teaching an onion palette: peel each shape into boundary
;; layers and read the majority color per depth. Recolor panel 3 by
;; that palette (the EXPECTED answer) and emit one row marking which
;; of the remaining candidate panels equals it (8 = match).
(lambda (g)
(let ()
(define (keep-cell? v) (and (not (= v 0)) (not (= v 9))))
(define (comp-masks grid) ;; one 0/1 mask per shape, left-to-right
(map (lambda (obj)
(paint-cells (empty-grid (rows grid) (cols grid) 0)
(obj-cells obj) 1))
(sort (objects (grid-from-fn (rows grid) (cols grid)
(lambda (r c)
(if (keep-cell?
(at grid r c))
1 0)))
0)
(lambda (a b)
(let ((ac (obj-cells a)) (bc (obj-cells b)))
(if (= (min-of second ac) (min-of second bc))
(< (min-of first ac) (min-of first bc))
(< (min-of second ac)
(min-of second bc))))))))
(define (peel layers cur depth) ;; onion: boundary ring = depth
(if (empty? cur)
layers
(let ((boundary
(filter (lambda (p)
(any? (lambda (d)
(not (member? (list (+ (first p)
(first d))
(+ (second p)
(second d)))
cur)))
cardinal-deltas))
cur)))
(peel (paint-cells layers boundary depth)
(filter (lambda (p) (not (member? p boundary)))
cur)
(+ depth 1)))))
(define (onion grid)
(for/fold ((layers (empty-grid (rows grid) (cols grid) 0)))
((comp (in-list (comp-masks grid))))
(peel layers
(filter (lambda (p) (> (at comp (first p) (second p))
0))
(grid-positions comp))
1)))
(define (panels-of grid) ;; split at full maroon columns
(let scan ((c 0) (start 0) (acc (list)))
(cond ((= c (cols grid))
(if (> c start)
(append acc (list (subgrid grid 0 start
(- (rows grid) 1)
(- c 1))))
acc))
((all? (lambda (r) (= (at grid r c) 9))
(range 0 (rows grid)))
(scan (+ c 1) (+ c 1)
(if (> c start)
(append acc (list (subgrid grid 0 start
(- (rows grid) 1)
(- c 1))))
acc)))
(else (scan (+ c 1) start acc)))))
(define (majority vals)
(let ((nz (filter (lambda (v) (not (= v 0))) vals)))
(if (empty? nz)
0
(first (first (sort (map (lambda (col)
(list col
(count-if (lambda (v)
(= v col))
nz)))
(remove-duplicates nz))
(lambda (a b)
(if (= (second a) (second b))
(< (first a) (first b))
(> (second a) (second b))))))))))
(define (palette-from plain colored) ;; depth -> majority color
(let* ((layers (onion plain))
(depths (filter (lambda (v) (> v 0))
(apply append layers))))
(map (lambda (d)
(majority (map (lambda (p) (at colored (first p)
(second p)))
(filter (lambda (p)
(= (at layers (first p)
(second p))
d))
(grid-positions layers)))))
(range 1 (+ (if (empty? depths) 0 (apply max depths))
1)))))
(define (recolor panel palette)
(let ((layers (onion panel)))
(grid-from-fn (rows panel) (cols panel)
(lambda (r c)
(let ((d (at layers r c)))
(cond ((= d 0) 0)
((empty? palette) 0)
(else (nth palette
(min (- d 1)
(- (length palette)
1))))))))))
(let* ((panels (panels-of g))
(expected (recolor (third panels)
(palette-from (first panels)
(second panels)))))
(list (map (lambda (cand) (if (equal? expected cand) 8 0))
(rest (rest (rest panels)))))))))Provenance
- Generator
- generators/6c68e1b008a5/generator.py
- Notes and decisions
- generators/6c68e1b008a5/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- dfdc1d18d5aa346fac3ac346ccd8fcaa1bc7b6403567863d77aa1851b89428e7
- Rule hash
- 392b20c1c503
- Sources
- bank:9cb3cc0a41e6
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate 6c68e1b008a5 --count 1 --seed 20261108 --test 1