← 73f849e69e0a · 7494855fa379 →

747486860e56

Preserve the uniquely largest multicolor 8-connected nonzero object. Every other nonzero cell counts and votes, including small touching groups. The most frequent residual color wins, with row-major first occurrence breaking ties. The unique residual corner selects orientation. Erase all residual cells, then paint a triangle of leg residual-count minus one, overwriting any overlap with the preserved object.

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)))
           (let ((objs (objects-multicolor g 0)))
             (let ((diag (first (sort-by objs (lambda (o) (- 0 (obj-size o)))))))
               (let ((diag-cells (obj-cells diag)))
                 (let ((isolated (filter (lambda (p)
                                           (not (for/or ((d diag-cells))
                                                        (and
                                                          (= (first d) (first p))
                                                          (= (second d) (second p))))))
                                         (filter (lambda (p)
                                                   (not (zero? (at g
                                                                   (first p)
                                                                   (second p)))))
                                                 (reduce append
                                                         (list)
                                                         (map (lambda (r)
                                                                (map (lambda (c)
                                                                       (list r c))
                                                                     (range 0 w)))
                                                              (range 0 h)))))))
                   (let* ((n (- (length isolated) 1))
                          (isolated-colors (map (lambda (p) (at g (first p) (second p)))
                                                isolated))
                          (color-count (lambda (v)
                                         (length (filter (lambda (p)
                                                           (= (at g
                                                                  (first p)
                                                                  (second p))
                                                              v))
                                                         isolated))))
                          (first-index (lambda (v)
                                         (let ((p (first (filter (lambda (p2)
                                                                   (= (at g
                                                                          (first p2)
                                                                          (second p2))
                                                                      v))
                                                                 isolated))))
                                           (+ (* (first p) w) (second p)))))
                          (tri-color (first (sort (unique isolated-colors)
                                                  (lambda (a b)
                                                    (let ((ca (color-count a))
                                                          (cb (color-count b)))
                                                      (if (= ca cb)
                                                          (< (first-index a)
                                                             (first-index b))
                                                          (> ca cb))))))))
                     (let ((corner (find (lambda (p)
                                           (or
                                             (and (zero? (first p)) (zero? (second p)))
                                             (and
                                               (zero? (first p))
                                               (= (second p) (- w 1)))
                                             (and
                                               (= (first p) (- h 1))
                                               (zero? (second p)))
                                             (and
                                               (= (first p) (- h 1))
                                               (= (second p) (- w 1)))))
                                         isolated)))
                       (if (not corner)
                           g
                           (let ((cr (first corner))
                                 (cc (second corner)))
                             (let ((base (reduce (lambda (gg d)
                                                   (set-cell gg
                                                             (first d)
                                                             (second d)
                                                             (at g (first d) (second d))))
                                                 (grid-from-fn h w (lambda (r c) 0))
                                                 diag-cells)))
                               (reduce (lambda (gg i)
                                         (let ((num (- n i)))
                                           (reduce (lambda (gg2 j)
                                                     (let ((tr (if (zero? cr)
                                                                   i
                                                                   (- (- h 1) i)))
                                                           (tc (if (zero? cc)
                                                                   j
                                                                   (- (- w 1) j))))
                                                       (set-cell gg2 tr tc tri-color)))
                                                   gg
                                                   (range 0 num))))
                                       base
                                       (range 0 n))))))))))))))

Provenance

Generator
generators/747486860e56/generator.py
Notes and decisions
generators/747486860e56/notes.md
Review label
reviewed_safe
Generator SHA-256
008f30c17748241bfc1bc3678dda6f34faba375edea6cc20a447a3823a9aa8ad
Rule hash
0ab2a183017a
Sources
augmented, training
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 747486860e56 --count 1 --seed 20261108 --test 1