← 8d45a1d4a531 · 8d7d1364cf11 →

8d46d66e31b0

Small 2-color template + 1-2 rect-frames in other colors (large enough to fit centered template).

centeringframe detectionrecoloringtemplate extraction

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 (rect-border? obj)
      (let* ((bb (obj-bbox obj))
             (h (+ (- (third bb) (first bb)) 1))
             (w (+ (- (fourth bb) (second bb)) 1))
             (border-size (- (* h w) (* (max 0 (- h 2)) (max 0 (- w 2))))))
        (and (>= (obj-size obj) 8)
             (= (obj-size obj) border-size)
             (all? (lambda (p)
                     (or (= (first p) (first bb)) (= (first p) (third bb))
                         (= (second p) (second bb)) (= (second p) (fourth bb))))
                   (obj-cells obj)))))
    (define (normalize cells)
      (let ((bb (bbox-of-cells cells)))
        (map (lambda (p) (list (- (first p) (first bb)) (- (second p) (second bb)))) cells)))
    (define (floor-half x)
      (if (>= x 0) (quotient x 2) (- 0 (quotient (+ (- 0 x) 1) 2))))
    (define (center-stamp out templ frame)
      (let* ((bb (obj-bbox frame))
             (tbb (bbox-of-cells templ))
             (th (+ (- (third tbb) (first tbb)) 1))
             (tw (+ (- (fourth tbb) (second tbb)) 1))
             (ih (- (obj-h frame) 2))
             (iw (- (obj-w frame) 2))
             (sr (+ (obj-r1 frame) 1 (floor-half (- ih th))))
             (sc (+ (obj-c1 frame) 1 (floor-half (- iw tw)))))
        (paint-cells out
                     (map (lambda (p) (list (+ sr (first p)) (+ sc (second p)))) templ)
                     (obj-color frame))))
    (let* ((source (first (filter (lambda (obj) (not (rect-border? obj))) (objects (keep-only g 2) 0))))
           (templ (normalize (obj-cells source)))
           (frames (filter rect-border?
                           (flatmap (lambda (color) (objects (keep-only g color) 0))
                                    (filter (lambda (color) (not (= color 2))) (grid-colors g 0))))))
      (for/fold ([out (empty-grid (rows g) (cols g) 0)]) ([frame (in-list frames)])
        (center-stamp (paint-cells out (obj-cells frame) (obj-color frame)) templ frame)))))

Provenance

Generator
generators/8d46d66e31b0/generator.py
Notes and decisions
generators/8d46d66e31b0/notes.md
Review label
reviewed_safe
Generator SHA-256
9fa026647dff039c6fdfc3b41a65a40750891520ae09c3f1c8e617d058b83df7
Rule hash
e38ec08c6bf9
Sources
bank:f3a2e93ae563
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 8d46d66e31b0 --count 1 --seed 20261108 --test 1