← dd6724624b9f · ddea3e6a1791 →

ddaee6c28dd7

Select the unique component with the widest bounding box, crop its exact mask to that box, and recolor the selected cells to 8.

bounding boxescroppingwidth comparison

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 (top-left< a b) (if (= (comp-r1 a) (comp-r1 b)) (< (comp-c1 a) (comp-c1 b)) (< (comp-r1 a) (comp-r1 b)))) (define (object-mask obj) (let* ((r0 (obj-r1 obj)) (c0 (obj-c1 obj)) (h (obj-h obj)) (w (obj-w obj)) (cells (map (lambda (p) (list (- (first p) r0) (- (second p) c0))) (obj-cells obj)))) (paint-cells (empty-grid h w 0) cells 1))) (define (mask-holes mask) (length (filter (lambda (region) (all? (lambda (p) (and (> (first p) 0) (< (first p) (- (rows mask) 1)) (> (second p) 0) (< (second p) (- (cols mask) 1)))) region)) (find-0-regions mask 0)))) (define (shape-perimeter obj) (let ((cells (obj-cells obj))) (for/sum ((p (in-list cells))) (count-where (lambda (d) (not (member (list (+ (first p) (first d)) (+ (second p) (second d))) cells))) cardinal-deltas)))) (define (row-symmetry obj) (let* ((r0 (obj-r1 obj)) (c0 (obj-c1 obj)) (h (obj-h obj)) (norm (map (lambda (p) (list (- (first p) r0) (- (second p) c0))) (obj-cells obj)))) (all? (lambda (p) (member (list (- h 1 (first p)) (second p)) norm)) norm))) (define (col-symmetry obj) (let* ((r0 (obj-r1 obj)) (c0 (obj-c1 obj)) (w (obj-w obj)) (norm (map (lambda (p) (list (- (first p) r0) (- (second p) c0))) (obj-cells obj)))) (all? (lambda (p) (member (list (first p) (- w 1 (second p))) norm)) norm))) (define (border-touch obj grid) (any? (lambda (p) (or (= (first p) 0) (= (second p) 0) (= (first p) (- (rows grid) 1)) (= (second p) (- (cols grid) 1)))) (obj-cells obj))) (define (make-comp obj grid) (let* ((mask (object-mask obj)) (rsym (row-symmetry obj)) (csym (col-symmetry obj)) (sym-count (+ (if rsym 1 0) (if csym 1 0)))) (list obj (obj-color obj) (obj-cells obj) (obj-size obj) (obj-r1 obj) (obj-c1 obj) (obj-r2 obj) (obj-c2 obj) (obj-h obj) (obj-w obj) (mask-holes mask) rsym csym sym-count (border-touch obj grid) (shape-perimeter obj)))) (define (describe-components grid) (map (lambda (obj) (make-comp obj grid)) (objects grid 0))) (define (comp-cells x) (third x)) (define (comp-area x) (fourth x)) (define (comp-r1 x) (list-ref x 4)) (define (comp-c1 x) (list-ref x 5)) (define (comp-h x) (list-ref x 8)) (define (comp-w x) (list-ref x 9)) (define (crop-component comp (color 8)) (let* ((h (comp-h comp)) (w (comp-w comp)) (cells (map (lambda (p) (list (- (first p) (comp-r1 comp)) (- (second p) (comp-c1 comp)))) (comp-cells comp)))) (paint-cells (empty-grid h w 0) cells color))) (define target (first (sort (describe-components g) (lambda (a b) (cond ((not (= (comp-w a) (comp-w b))) (> (comp-w a) (comp-w b))) ((not (= (comp-area a) (comp-area b))) (> (comp-area a) (comp-area b))) (else (top-left< a b))))))) (crop-component target 8)))

Provenance

Generator
generators/ddaee6c28dd7/generator.py
Notes and decisions
generators/ddaee6c28dd7/notes.md
Review label
reviewed_safe
Generator SHA-256
6ac7eaeb9ee994eaf6718fac97d68d4adcae0ef16809489b699899d491a659c5
Rule hash
4a26a7475b9d
Sources
bank:545aa94c7c6c
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate ddaee6c28dd7 --count 1 --seed 20261108 --test 1