← 7c2b3290ba62 · 7cda20c438b7 →

7c7f1f574a18

Find same-colour foreground components against the modal background. A solid bbox or a component with a truly enclosed bbox gap is closed: preserve its rows/shape, recolour it 2, and dock it left. If every bbox gap reaches the bbox boundary, recolour it 3 and dock it right. Generated lessons contain a solid closed object, an irregular hole-bearing closed object, and an open almost-ring with roles crossing their starting sides.

parametric family

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! (lambda (g)
         (let* ((h (rows g))
                (w (cols g)))
           (begin
             (define bg (mode g -1))
             (define objs
               (sort-by (objects g bg)
                        (lambda (obj) (+ (* 1000 (obj-r1 obj)) (obj-c1 obj)))))
             (define (cell-in-obj? obj r c) (member (list r c) (obj-cells obj)))
             (define (bbox-gaps obj)
               (for*/list ((r (range (obj-r1 obj) (+ (obj-r2 obj) 1))) (c (range (obj-c1 obj) (+ (obj-c2 obj) 1)))
                   #:when
                   (not (cell-in-obj? obj r c)))
                 (list r c)))
             (define (interior-gap? obj p)
               (let* ((r1 (obj-r1 obj))
                      (c1 (obj-c1 obj))
                      (r2 (obj-r2 obj))
                      (c2 (obj-c2 obj))
                      (region (connected-region g
                                                (first p)
                                                (second p)
                                                (lambda (r c v)
                                                  (and
                                                    (>= r r1)
                                                    (<= r r2)
                                                    (>= c c1)
                                                    (<= c c2)
                                                    (not (cell-in-obj? obj r c))))
                                                4)))
                 (not (for/or ((q region))
                              (or
                                (= (first q) r1)
                                (= (first q) r2)
                                (= (second q) c1)
                                (= (second q) c2))))))
             (define (closed-class? obj)
               (let ((gaps (bbox-gaps obj)))
                 (or (empty? gaps) (for/or ((p gaps)) (interior-gap? obj p)))))
             (define (stamp out obj color dest-c)
               (for/fold ((acc out))
                 ((p (obj-cells obj)))
                 (set-cell acc (first p) (+ dest-c (- (second p) (obj-c1 obj))) color)))
             (for/fold ((out (empty-grid h w bg)))
               ((obj objs))
               (if (closed-class? obj)
                   (stamp out obj 2 0)
                   (stamp out obj 3 (- w (obj-w obj)))))))))

Provenance

Generator
generators/7c7f1f574a18/generator.py
Notes and decisions
generators/7c7f1f574a18/notes.md
Review label
reviewed_safe
Generator SHA-256
27d4ef0b4f69c061c19b98ecb426edae19013204771b4b34c4a6e47ad9c5902f
Rule hash
e048ab46f343
Sources
training
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 7c7f1f574a18 --count 1 --seed 20261108 --test 1