← ed98575459d2 · edb55a59dc46 →
edb34dd65185
2-3 distinct-color, non-skinny shapes with distinct interior-hole counts (0/1/2); verified full placement.
parametric familycomponent sortinghole countingvertical packing
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 (count-nonzero-grid grid) (count-where (lambda (cell) (not (= (third cell) 0))) (grid-cells grid))) (define (min-nonzero grid) (apply min (map third (filter (lambda (cell) (not (= (third cell) 0))) (grid-cells grid))))) (define (zero-component-count crop) (let loop ((remaining (filter-cells crop (lambda (r c v) (= v 0)))) (holes 0)) (if (empty? remaining) holes (let* ((p (first remaining)) (region (connected-region crop (first p) (second p) (lambda (r c v) (= v 0)) 4)) (touches-border? (any? (lambda (q) (or (= (first q) 0) (= (second q) 0) (= (first q) (- (rows crop) 1)) (= (second q) (- (cols crop) 1)))) region))) (loop (filter (lambda (q) (not (member? q region))) remaining) (if touches-border? holes (+ holes 1))))))) (define (paste-nonzero out pat top left) (for*/fold ((acc out)) ((r (in-range (rows pat))) (c (in-range (cols pat))) #:when (not (= (at pat r c) 0))) (let ((rr (+ top r)) (cc (+ left c))) (if (in-bounds? rr cc (rows acc) (cols acc)) (set-cell acc rr cc (at pat r c)) acc)))) (define (pack-vertical crops) (let loop ((out (empty-grid (rows g) (cols g) 0)) (remaining crops) (top 0)) (if (empty? remaining) out (loop (paste-nonzero out (first remaining) top 0) (rest remaining) (+ top (rows (first remaining)) 1))))) (let* ((entries (map (lambda (obj) (let ((crop (crop-object g obj))) (list (zero-component-count crop) crop))) (objects g 0))) (ordered (map second (sort entries (lambda (a b) (let ((ha (first a)) (hb (first b)) (ca (second a)) (cb (second b))) (cond ((not (= ha hb)) (< ha hb)) ((not (= (count-nonzero-grid ca) (count-nonzero-grid cb))) (< (count-nonzero-grid ca) (count-nonzero-grid cb))) (else (< (min-nonzero ca) (min-nonzero cb)))))))))) (pack-vertical ordered))))
Provenance
- Generator
- generators/edb34dd65185/generator.py
- Notes and decisions
- generators/edb34dd65185/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- aeeb830e560dc87bc1869d6c417679454502f9188014d305296062e29deb885d
- Rule hash
- 65064acc4c1b
- Sources
- bank:26462ff56908
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate edb34dd65185 --count 1 --seed 20261108 --test 1