← public_eval_142ca369 · public_eval_16de56c4 →

public_eval_16b78196

Assemble same-color pieces into contour-compatible chains extending from a spanning wall.

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)

(rule!
 ;; A spanning colored wall supplies the first interlocking contours. Translate
 ;; loose same-color pieces without rotation. A whole leading contour must touch
 ;; one predecessor's exposed interface; a flat edge is not an interlock.
 ;; Each placed piece exposes the next contour. Chains may grow on either side.
 ;; Backtrack locally matching placements that leave a later piece unplaceable.
 ;; Background is black. Erase loose source copies and preserve the wall.
 (lambda (g)
   (let ()
     (define source-wall (first (filter (lambda (o) (or (= (obj-h o) h) (= (obj-w o) w))) (objects g 0))))
     (define vertical (= (obj-h source-wall) h))
     (define board (if vertical (transpose g) g))
     (define hh (rows board))
     (define ww (cols board))
     (define obs (objects board 0))
     (define wall (first (filter (lambda (o) (= (obj-w o) ww)) obs)))
     (define pieces (filter (lambda (o) (not (equal? o wall))) obs))
     (define ids (range (length pieces)))
     (define local (map (lambda (o) (normalize-cells (obj-cells o))) pieces))
     (define (profile i side)
       (let ((cells (list-ref local i)))
         (for/list ((j (range (obj-w (list-ref pieces i)))))
           (apply (if (= side 1) min max)
             (map first (filter (lambda (p) (= (second p) j)) cells))))))
     (define initial (recolor-cells (empty-grid hh ww 0) (obj-cells wall) (obj-color wall)))
     (define owners0 (recolor-cells (empty-grid hh ww -1) (obj-cells wall) 0))
     (define state
       (let loop ((pending ids) (out initial) (owners owners0) (depths (map (lambda (i) 0) ids)))
         (if (null? pending) (list out owners depths)
           (let ()
             (define upper (for/list ((c (range ww))) (apply min (filter (lambda (r) (not (= (at out r c) 0))) (range hh)))))
             (define lower (for/list ((c (range ww))) (apply max (filter (lambda (r) (not (= (at out r c) 0))) (range hh)))))
             (define candidates
               (for*/fold ((found '())) ((i pending) (side '(-1 1)) (cc (range (+ 1 (- ww (obj-w (list-ref pieces i)))))))
                 (let* ((o (list-ref pieces i)) (pp (profile i side))
                        (edge (take (drop (if (= side 1) lower upper) cc) (obj-w o)))
                        (rr (- (+ (first edge) side) (first pp)))
                        (moved (map (lambda (p) (list (+ rr (first p)) (+ cc (second p)))) (list-ref local i)))
                        (contact (remove-duplicates (for/list ((j (range (obj-w o)))) (at owners (list-ref edge j) (+ cc j))))))
                   (if (and (> (apply max edge) (apply min edge))
                            (= (length contact) 1)
                            (or (= (first contact) 0) (= (obj-w o) (obj-w (list-ref pieces (- (first contact) 1)))))
                            (andmap (lambda (j) (= (+ rr (list-ref pp j)) (+ side (list-ref edge j)))) (range (obj-w o)))
                            (andmap (lambda (p) (and (<= 0 (first p)) (< (first p) hh) (<= 0 (second p)) (< (second p) ww)
                                                    (= (at out (first p) (second p)) 0))) moved))
                       (cons (list i moved (+ 1 (if (= (first contact) 0) 0 (list-ref depths (- (first contact) 1))))) found)
                       found))))
             (for/or ((step candidates))
               (let* ((i (first step)) (cells (second step)) (depth (third step)))
                 (loop (remove i pending)
                       (recolor-cells out cells (obj-color (list-ref pieces i)))
                       (recolor-cells owners cells (+ i 1))
                       (map (lambda (j) (if (= i j) depth (list-ref depths j))) ids))))))))
     (define result (first (or state (error 'assembly "No complete interlocking assembly"))))
     (if vertical (transpose result) result))))

Provenance

Generator
generators/public_eval_16b78196/generator.py
Notes and decisions
generators/public_eval_16b78196/notes.md
Review label
reviewed_safe
Generator SHA-256
b33b2ae154660f97e25f73b04cdc7d541a652a975d6e06376cf403120a484ec8
Rule hash
7bc17d2be2ab
Sources
evaluation, public_eval:16b78196
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate public_eval_16b78196 --count 1 --seed 20261108 --test 1