← public_eval_e87109e9 · public_eval_eee78d87 →
public_eval_edb79dae
Crop the frame, retain every original-color template piece, and apply one direct legend color step.
parametric family
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)
; Direct rule for public evaluation parent edb79dae.
; Default uses simultaneous one-step legend substitutions.
; The template always belongs to the ORIGINAL block color. Nine steps reach
; the terminal color in the admitted acyclic ARC-palette mapping grammar.
(rule!
(lambda (g)
(define frequency (color-frequency g))
(define maximum-frequency (apply max (hash-values frequency)))
(define backgrounds
(filter (lambda (c) (= (hash-ref frequency c) maximum-frequency))
(hash-keys frequency)))
(unless (= (length backgrounds) 1)
(error "legend-templates: background mode must be unique"))
(define bg (first backgrounds))
(define components (objects g bg))
(define frames
(filter
(lambda (o)
(and (>= (obj-h o) 5) (>= (obj-w o) 5)
(= (obj-size o) (- (* 2 (+ (obj-h o) (obj-w o))) 4))
(for/and ([p (in-list (obj-cells o))])
(or (= (first p) (obj-r1 o)) (= (first p) (obj-r2 o))
(= (second p) (obj-c1 o)) (= (second p) (obj-c2 o))))))
components))
(unless (= (length frames) 1)
(error "legend-templates: expected one complete hollow frame"))
(define frame (first frames))
(define fr (obj-r1 frame))
(define fc (obj-c1 frame))
(define lr (obj-r2 frame))
(define lc (obj-c2 frame))
(define frame-color (obj-color frame))
(define (outside-frame? r c)
(not (and (<= fr r lr) (<= fc c lc))))
(define arrows
(for*/list ([r (in-range (- (rows g) 2))]
[c (in-range (- (cols g) 3))]
#:when
(let ([s (cell-at g r c)] [t (cell-at g r (+ c 3))])
(and (not (= s t))
(not (member s (list bg frame-color)))
(not (member t (list bg frame-color)))
(for*/and ([dr (in-range 3)] [dc (in-range 4)])
(and (outside-frame? (+ r dr) (+ c dc))
(= (cell-at g (+ r dr) (+ c dc))
(if (or (< dc 2) (and (= dr 1) (= dc 2)))
s t)))))))
(list r c (cell-at g r c) (cell-at g r (+ c 3)))))
(when (empty? arrows) (error "legend-templates: missing arrows"))
(define excluded (make-hash))
(define mapping (make-hash))
(for ([a (in-list arrows)])
(define s (third a))
(define t (fourth a))
(when (and (hash-has-key? mapping s) (not (= (hash-ref mapping s) t)))
(error "legend-templates: conflicting arrows"))
(hash-set! mapping s t)
(for* ([dr (in-range 3)] [dc (in-range 4)])
(hash-set! excluded (list (+ (first a) dr) (+ (second a) dc)) #t)))
(define external (make-hash))
(for* ([r (in-range (rows g))] [c (in-range (cols g))])
(define v (cell-at g r c))
(when (and (outside-frame? r c)
(not (= v bg)) (not (= v frame-color))
(not (hash-has-key? excluded (list r c))))
(hash-update! external v (lambda (points) (cons (list r c) points)) '())))
(define templates (make-hash))
(for ([(color points) (in-hash external)])
(define top (apply min (map first points)))
(define left (apply min (map second points)))
(hash-set! templates color
(for/list ([p (in-list points)])
(list (- (first p) top) (- (second p) left)))))
(define blocks
(filter (lambda (o)
(and (< fr (obj-r1 o)) (< (obj-r2 o) lr)
(< fc (obj-c1 o)) (< (obj-c2 o) lc)
(= (obj-h o) (obj-w o))
(= (obj-size o) (* (obj-h o) (obj-w o)))))
components))
(define (mapped-color original)
(let walk ([color original] [remaining 1])
(if (or (zero? remaining) (not (hash-has-key? mapping color)))
color
(walk (hash-ref mapping color) (sub1 remaining)))))
(define painted (make-hash))
(for ([block (in-list blocks)])
(define original (obj-color block))
(unless (and (hash-has-key? templates original)
(hash-has-key? mapping original))
(error "legend-templates: block lacks original template or arrow"))
(define mask (hash-ref templates original))
(unless (and (= (add1 (apply max (map first mask))) (obj-h block))
(= (add1 (apply max (map second mask))) (obj-w block)))
(error "legend-templates: template and square sizes differ"))
(define target (mapped-color original))
(for* ([dr (in-range (obj-h block))] [dc (in-range (obj-w block))])
(hash-set! painted (list (+ (obj-r1 block) dr) (+ (obj-c1 block) dc))
(if (member (list dr dc) mask) target bg))))
(grid-from-fn (obj-h frame) (obj-w frame)
(lambda (r c)
(define source-r (+ fr r))
(define source-c (+ fc c))
(hash-ref painted (list source-r source-c)
(lambda () (cell-at g source-r source-c)))))))
Provenance
- Generator
- generators/public_eval_edb79dae/generator.py
- Notes and decisions
- generators/public_eval_edb79dae/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- c343ca921fbd98efd2df5067a86c5eab99f608e025d42e85c9c3165b1e6b9f18
- Rule hash
- 36d2241c877e
- Sources
- evaluation, public_eval:edb79dae
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate public_eval_edb79dae --count 1 --seed 20261108 --test 1