← 18a3c532c9dc · 18e652e005b1 →

18bd3cd2985e

Hollow rectangular frames and four-connected singleton components on zero. Erase the singletons; fill local even-parity interior cells only when their count equals that color's singleton count. Scenes include all, partial and absent count matches, varied colors, sizes, positions and diagonal singles.

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))
         (all-objs (objects g 0))
         ;; Rectangles: multi-cell components
         (rects
          (for/list ((o all-objs)
                     #:when (> (length (obj-cells o)) 1))
            (let ((bb (obj-bbox o)))
              (list (obj-color o) (first bb) (second bb) (third bb) (fourth bb)))))
         ;; Singles: single-cell components, count by color
         (single-colors
          (for/list ((o all-objs)
                     #:when (= (length (obj-cells o)) 1))
            (obj-color o)))
         (color-counts
          (let loop ((cs single-colors) (acc (hash)))
            (cond
              ((null? cs) acc)
              (else
               (let ((c (car cs)))
                 (loop (cdr cs) (hash-set acc c (+ 1 (hash-ref acc c 0))))))))))
    ;; Start by removing all scattered pixels (but keep rect cells)
    (let* ((out1
            (for*/fold ((out g)) ((r (range 0 h)) (c (range 0 w)))
              (let ((v (cell-at g r c)))
                (cond
                  ((= v 0) out)
                  (else
                   ;; Check if this cell is inside any rect bbox of the same color
                   (let ((is-rect
                          (for/or ((rect rects))
                            (and (= (first rect) v)
                                 (>= r (second rect))
                                 (<= r (fourth rect))
                                 (>= c (third rect))
                                 (<= c (fifth rect))))))
                     (if is-rect out (set-cell out r c 0))))))))
           ;; Fill rectangles with checkerboard based on color counts
           (out2
            (for/fold ((out out1)) ((color (hash-keys color-counts)))
              (let ((count (hash-ref color-counts color)))
                ;; Find matching rect
                (let loop ((rs rects))
                  (cond
                    ((null? rs) out)
                    (else
                     (let* ((rect (car rs))
                            (r1 (second rect)) (c1 (third rect))
                            (r2 (fourth rect)) (c2 (fifth rect))
                            (rh (+ 1 (- r2 r1)))
                            (rw (+ 1 (- c2 c1)))
                            (ih (- rh 2))
                            (iw (- rw 2))
                            (n (* ih iw))
                            (half (quotient (+ n 1) 2)))
                       (cond
                         ((and (> ih 0) (> iw 0) (= half count))
                          (for*/fold ((gg out)) ((i (range 0 ih)) (j (range 0 iw))
                                                  #:when (= (modulo (+ i j) 2) 0))
                            (set-cell gg (+ r1 1 i) (+ c1 1 j) color)))
                         (else (loop (cdr rs))))))))))))
      out2))))

Provenance

Generator
generators/18bd3cd2985e/generator.py
Notes and decisions
generators/18bd3cd2985e/notes.md
Review label
reviewed_safe
Generator SHA-256
c90ed220b7bad99f254f4c1bf96336105b1298ee902eff503e1398d99c1c07a5
Rule hash
70c5793d0c5a
Sources
augmented, training
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 18bd3cd2985e --count 1 --seed 20261108 --test 1