← e685e65af79d · e69a3b575440 →

e68b376152cd

A 0-background grid contains 2-5 distinctly colored 4-connected objects. Sort objects by (bounding-box left column, bounding-box top row), tightly crop each object, and pack the crops horizontally with exactly one black column between neighbors. Vertically center every crop in an output whose height is the maximum crop height.

parametric familyobjectsoutput_resizepackingrelayout

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 (obj-bbox-width obj) (+ 1 (- (obj-c2 obj) (obj-c1 obj)))) (define (obj-bbox-height obj) (+ 1 (- (obj-r2 obj) (obj-r1 obj)))) (define (bbox< a b) (if (= (obj-c1 a) (obj-c1 b)) (< (obj-r1 a) (obj-r1 b)) (< (obj-c1 a) (obj-c1 b)))) (define (component-grid obj) (for/fold ((out (empty-grid (obj-bbox-height obj) (obj-bbox-width obj) 0))) ((p (in-list (obj-cells obj)))) (set-cell out (- (first p) (obj-r1 obj)) (- (second p) (obj-c1 obj)) (obj-color obj)))) (define (paste-crop grid shape top left) (for*/fold ((out grid)) ((r (in-range (rows shape))) (c (in-range (cols shape)))) (let ((v (at shape r c)) (rr (+ top r)) (cc (+ left c))) (if (and (not (= v 0)) (in-bounds? rr cc (rows grid) (cols grid))) (set-cell out rr cc v) out)))) (define (pack-gallery shapes gap align) (let* ((h (if (empty? shapes) 1 (apply max (map rows shapes)))) (w (if (empty? shapes) 1 (+ (apply + (map cols shapes)) (* gap (max 0 (- (length shapes) 1))))))) (let loop ((remaining shapes) (left 0) (out (empty-grid h w 0))) (if (empty? remaining) out (let* ((shape (first remaining)) (top (cond ((equal? align 'top) 0) ((equal? align 'bottom) (- h (rows shape))) (else (quotient (- h (rows shape)) 2))))) (loop (rest remaining) (+ left (cols shape) gap) (paste-crop out shape top left))))))) (pack-gallery (map component-grid (sort (objects g 0) bbox<)) 1 'center)))

Provenance

Generator
generators/e68b376152cd/generator.py
Notes and decisions
generators/e68b376152cd/notes.md
Review label
reviewed_safe
Generator SHA-256
0ba2e6f86775db131927f16aa43f3f1aa79ec313024372c24f00beee0f33a319
Rule hash
c90e481827fb
Sources
bank:fc0f4ba66a95
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate e68b376152cd --count 1 --seed 20261108 --test 1