← 8712c5635d80 · 8738d400fb96 →

87388eaff4ce

Extract each nonzero 4-connected object, crop it to its bounding box, sort by bounding-box height descending with color ascending as the tie-break, then vertically pack the left-aligned crops with one zero row between neighboring crops.

objectspackingresizesorting

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* ((items (sort (map (lambda (obj)
                             (let ((crop (subgrid g (obj-r1 obj) (obj-c1 obj) (obj-r2 obj) (obj-c2 obj))))
                               (list (rows crop) (obj-color obj) crop)))
                           (objects g 0))
                      (lambda (a b)
                        (if (= (first a) (first b))
                            (< (second a) (second b))
                            (> (first a) (first b))))))
         (shapes (map third items))
         (out-h (+ (apply + (map rows shapes)) (max 0 (- (length shapes) 1))))
         (out-w (apply max (map cols shapes))))
    (let pack ([remaining shapes] [top 0] [out (empty-grid out-h out-w 0)])
      (if (empty? remaining)
          out
          (let* ((shape (first remaining))
                 (next (for*/fold ([acc out])
                                   ([r (in-range (rows shape))]
                                    [c (in-range (cols shape))])
                         (let ((v (at shape r c)))
                           (if (not (= v 0)) (set-cell acc (+ top r) c v) acc)))))
            (pack (rest remaining) (+ top (rows shape) 1) next))))))

Provenance

Generator
generators/87388eaff4ce/generator.py
Notes and decisions
generators/87388eaff4ce/notes.md
Review label
reviewed_safe
Generator SHA-256
d4689258ca72838e9caaff746eb5fef2064103ac92f1946c0630365d9a41a1a7
Rule hash
c701ff882260
Sources
bank:a54e1d9e1d4b
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 87388eaff4ce --count 1 --seed 20261108 --test 1