← 73906110dd67 · 73f849e69e0a →

73d82a9cacf6

Extract each isolated nonzero object and crop it to its bounding box. Count enclosed zero regions inside each crop, sort by increasing hole count and then by decreasing painted area, and horizontally pack the crops with one black column between them. Exact remaining ties use color as the canonical oracle's deterministic fallback.

parametric familycomponent sortingpackingtopology

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).

Reference rule (Racket)

(rule!
  (let ((dummy 0))
    (define (crop-object obj) (subgrid g (obj-r1 obj) (obj-c1 obj) (obj-r2 obj) (obj-c2 obj)))
    (define (hole-count obj)
      ;; Same shape, translated so its bbox starts at (0,0)
      (let* ((norm (normalize-cells (obj-cells obj)))
             ;; Bounding box enclosing the cells
             (bb (bbox-of-cells norm))
             (h (+ (third bb) 3))
             (w (+ (fourth bb) 3))
             (occ (map (lambda (p) (list (+ (first p) 1) (+ (second p) 1))) norm)))
        (define (free? r c) (not (member? (list r c) occ)))
        (let loop ([remaining (filter (lambda (p) (free? (first p) (second p)))
                                      (positions-in-rect 0 0 (- h 1) (- w 1)))]
                   [holes 0])
          (if (empty? remaining)
              holes
              (let* ((p (first remaining))
                     (region (connected-region (empty-grid h w 0) (first p) (second p)
                                (lambda (r c v) (free? r c)) 4))
                     (touch? (any? (lambda (q) (or (= (first q) 0) (= (second q) 0)
                                                    (= (first q) (- h 1)) (= (second q) (- w 1))))
                                   region)))
                (loop (filter (lambda (q) (not (member? q region))) remaining)
                      (if touch? holes (+ holes 1))))))))
    (define (paste out pat left)
      (for*/fold ([acc out])
                 ([r (in-range (rows pat))]
                  [c (in-range (cols pat))]
                  #:when (not (= (at pat r c) 0)))
        (set-cell acc r (+ left c) (at pat r c))))
    (let* ((items (sort (map (lambda (obj) (list (hole-count obj) (- (obj-size obj)) (obj-color obj) (crop-object obj)))
                             (objects g 0))
                        (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))]))))
           (crops (map fourth items))
           (out-h (apply max (map rows crops)))
           (out-w (+ (apply + (map cols crops)) (max 0 (- (length crops) 1)))))
      (let loop ([out (empty-grid out-h out-w 0)] [remaining crops] [left 0])
        (if (empty? remaining)
            out
            (loop (paste out (first remaining) left)
                  (rest remaining)
                  (+ left (cols (first remaining)) 1)))))))

Provenance

Generator
generators/73d82a9cacf6/generator.py
Notes and decisions
generators/73d82a9cacf6/notes.md
Review label
reviewed_safe
Generator SHA-256
b8c145b02088ee9cf23ff9e5e35f3ebc07bd03f08b981c9eb9868ee181ce7d11
Rule hash
1d1a8e3f7274
Sources
bank:dc02f6f7c147
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 73d82a9cacf6 --count 1 --seed 20261108 --test 1