← 85de426e8683 · 860cbb625ca0 →
85e65da9fb15
A 0-background grid contains two hollow rectangular frames and two to four loose 4-connected shapes. Process loose shapes in top-left order. For each shape, choose the unused frame it fits most tightly by bbox area, breaking ties by frame top-left position; keep the original orientation when it fits, otherwise rotate 90 degrees clockwise if that fits. Center the shape in the chosen frame. Output only the frames and successfully filed shapes; unmatched shapes disappear.
parametric familyassignmentframesrotation
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!
;; Loose solid shapes get filed into hollow rectangular frames. Each
;; shape (top-left order) takes the frame it fits tightest — rotated
;; 90 degrees if only that fits — preferring less leftover interior,
;; then the topmost/leftmost frame; each frame holds one shape,
;; centered. Output: the frames with their contents, nothing else.
(lambda (g)
(let ()
(define (obj< a b)
(if (= (obj-r1 a) (obj-r1 b))
(< (obj-c1 a) (obj-c1 b))
(< (obj-r1 a) (obj-r1 b))))
(define (object-grid obj)
(paint-cells (empty-grid (obj-h obj) (obj-w obj) 0)
(normalize-cells (obj-cells obj))
(obj-color obj)))
(define (stamp out sub tr tc) ;; nonzero cells only, clipped
(foldl (lambda (cell acc)
(let ((r (+ tr (first cell))) (c (+ tc (second cell))))
(if (and (not (= (third cell) 0))
(in-bounds? r c (rows acc) (cols acc)))
(set-cell acc r c (third cell))
acc)))
out (grid-cells sub)))
(define (rect-frame? obj)
(and (>= (obj-h obj) 3) (>= (obj-w obj) 3)
(= (obj-size obj)
(- (* 2 (+ (obj-h obj) (obj-w obj))) 4))
(all? (lambda (c) (and (= (at g (obj-r1 obj) c)
(obj-color obj))
(= (at g (obj-r2 obj) c)
(obj-color obj))))
(range (obj-c1 obj) (+ (obj-c2 obj) 1)))
(all? (lambda (r) (and (= (at g r (obj-c1 obj))
(obj-color obj))
(= (at g r (obj-c2 obj))
(obj-color obj))))
(range (obj-r1 obj) (+ (obj-r2 obj) 1)))))
(define (fit-of entry og)
;; (leftover frame-r1 frame-c1 idx frame oriented-shape) or #f
(let* ((frame (second entry))
(ih (- (obj-h frame) 2))
(iw (- (obj-w frame) 2))
(rot (rotate-cw og))
(fit (cond ((and (<= (rows og) ih) (<= (cols og) iw)) og)
((and (<= (rows rot) ih) (<= (cols rot) iw))
rot)
(else #f))))
(and fit
(list (- (* ih iw) (* (rows fit) (cols fit)))
(obj-r1 frame) (obj-c1 frame)
(first entry) frame fit))))
(define all-objs (objects g 0))
(define frames (sort (filter rect-frame? all-objs) obj<))
(define indexed (enumerate-list frames))
(define solids
(sort (filter (lambda (o) (not (rect-frame? o))) all-objs) obj<))
(define (best-fit og used) ;; tightest, then topmost/leftmost
(let ((cands (filter (lambda (x) x)
(map (lambda (e)
(and (not (member (first e) used))
(fit-of e og)))
indexed))))
(and (not (empty? cands))
(first (sort cands
(lambda (a b)
(cond ((not (= (first a) (first b)))
(< (first a) (first b)))
((not (= (second a) (second b)))
(< (second a) (second b)))
(else (< (third a) (third b))))))))))
(let assign ((remaining solids) (used (list))
(out (for/fold ((o (empty-grid h w 0)))
((f (in-list frames)))
(paint-cells o (obj-cells f) (obj-color f)))))
(if (empty? remaining)
out
(let ((hit (best-fit (object-grid (first remaining)) used)))
(if hit
(let* ((frame (fifth hit))
(sub (sixth hit))
(tr (+ (obj-r1 frame) 1
(quotient (- (- (obj-h frame) 2)
(rows sub))
2)))
(tc (+ (obj-c1 frame) 1
(quotient (- (- (obj-w frame) 2)
(cols sub))
2))))
(assign (rest remaining) (cons (fourth hit) used)
(stamp out sub tr tc)))
(assign (rest remaining) used out))))))))Provenance
- Generator
- generators/85e65da9fb15/generator.py
- Notes and decisions
- generators/85e65da9fb15/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- 03e60e7208b6e286645bce4d0abbd63b081c17348db1197762c72c0a1dea9650
- Rule hash
- d63ea92287a9
- Sources
- bank:cf5246d38569
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate 85e65da9fb15 --count 1 --seed 20261108 --test 1