← 25e18d9bd322 · 2602c3d31d21 →

25e78410d5bb

Color-5 walls partition zero cells into a rectangular lattice. Two indicator colors sit in the walls; each zero region is filled with the strict-majority adjacent indicator color.

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)))
           (let* ((inverted (cellmap g (r c v) (if (zero? v) 1 0)))
                  (comps (objects inverted 0)))
             (for/fold ((gg g))
               ((comp comps))
               (let* ((cells (obj-cells comp))
                      (indicators (let collect
                                       ((cs cells) (acc (list)))
                                       (cond
                                         ((null? cs) acc)
                                         (else (let* ((cell (car cs))
                                                      (r (first cell))
                                                      (c (second cell))
                                                      (new-acc (let nbr-loop
                                                                    ((deltas (list (list -1
                                                                                         0)
                                                                                   (list 1
                                                                                         0)
                                                                                   (list 0
                                                                                         -1)
                                                                                   (list 0
                                                                                         1))) (a acc))
                                                                    (cond
                                                                      ((null? deltas) a)
                                                                      (else (let* ((d (car deltas))
                                                                                   (nr (+ r
                                                                                          (first d)))
                                                                                   (nc (+ c
                                                                                          (second d))))
                                                                              (cond
                                                                                ((or
                                                                                   (< nr
                                                                                      0)
                                                                                   (>= nr
                                                                                       h)
                                                                                   (< nc
                                                                                      0)
                                                                                   (>= nc
                                                                                       w)) (nbr-loop (cdr deltas)
                                                                                            a))
                                                                                (else (let ((v (at g
                                                                                                   nr
                                                                                                   nc)))
                                                                                        (cond
                                                                                          ((and
                                                                                             (!= v
                                                                                                 0)
                                                                                             (!= v
                                                                                                 5)) (nbr-loop (cdr deltas)
                                                                                                      (cons v
                                                                                                            a)))
                                                                                          (else (nbr-loop (cdr deltas)
                                                                                                          a))))))))))))
                                                 (collect (cdr cs) new-acc))))))
                      (counts (let loop
                                   ((lst indicators) (acc (list)))
                                   (cond
                                     ((null? lst) acc)
                                     (else (let* ((v (car lst))
                                                  (existing (assoc v acc)))
                                             (if existing
                                                 (loop (cdr lst)
                                                       (cons (cons v
                                                                   (+ 1 (cdr existing)))
                                                             (filter (lambda (p)
                                                                       (!= (car p) v))
                                                                     acc)))
                                                 (loop (cdr lst) (cons (cons v 1) acc))))))))
                      (majority (if (null? counts)
                                    #f
                                    (let loop
                                         ((cs counts) (best-v #f) (best-n -1))
                                         (cond
                                           ((null? cs) best-v)
                                           (else (let* ((p (car cs))
                                                        (v (car p))
                                                        (n (cdr p)))
                                                   (if (> n best-n)
                                                       (loop (cdr cs) v n)
                                                       (loop (cdr cs) best-v best-n)))))))))
                 (if majority
                     (for/fold ((ggg gg))
                       ((cell cells))
                       (set-cell ggg (first cell) (second cell) majority))
                     gg)))))))

Provenance

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