← a631936f7715 · a78185b4bd20 →

a76216bfa3e8

Stamp the unique marker-cell pattern into every lattice cell sharing both source row parity and source column parity, clipping at partial edges.

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!
 ;; Full lines of the dominant color rule the board into lattice cells.
 ;; One cell (the last in scan order holding anything) carries a marker
 ;; pattern: stamp that pattern into every cell sharing its row AND
 ;; column parity, clipped to each cell.
 (lambda (g)
   (let ()
     (define line-color
       (pick-max (filter (lambda (v) (> v 0))
                         (remove-duplicates
                          (map (lambda (p) (at g (first p) (second p)))
                               (grid-positions g))))
                 (lambda (v) (length (find-color g v)))))
     (define row-bounds
       (append (list -1)
               (filter (lambda (r) (all? (lambda (c) (= (at g r c)
                                                        line-color))
                                         (range 0 w)))
                       (range 0 h))
               (list h)))
     (define col-bounds
       (append (list -1)
               (filter (lambda (c) (all? (lambda (r) (= (at g r c)
                                                        line-color))
                                         (range 0 h)))
                       (range 0 w))
               (list w)))
     (define (spans bounds)
       (filter (lambda (p) (<= (first p) (second p)))
               (map (lambda (i) (list (+ 1 (nth bounds i))
                                      (- (nth bounds (+ i 1)) 1)))
                    (range 0 (- (length bounds) 1)))))
     (define row-spans (spans row-bounds))
     (define col-spans (spans col-bounds))
     (define (pattern-at cr cc)  ;; non-line cells relative to the cell
       (let ((rr (nth row-spans cr)) (cs (nth col-spans cc)))
         (for*/list ((r (range (first rr) (+ (second rr) 1)))
                     (c (range (first cs) (+ (second cs) 1)))
                     #:when (let ((v (at g r c)))
                              (and (not (= v 0))
                                   (not (= v line-color)))))
           (list (- r (first rr)) (- c (first cs)) (at g r c)))))
     (define marker  ;; LAST populated cell in scan order: (cr cc pat)
       (for*/fold ((best (list -1 -1 (list))))
                  ((cr (range 0 (length row-spans)))
                   (cc (range 0 (length col-spans))))
         (let ((pat (pattern-at cr cc)))
           (if (null? pat) best (list cr cc pat)))))
     (for*/fold ((out g))
                ((cr (range 0 (length row-spans)))
                 (cc (range 0 (length col-spans)))
                 #:when (and (= (modulo cr 2) (modulo (first marker) 2))
                             (= (modulo cc 2)
                                (modulo (second marker) 2))))
       (let ((rr (nth row-spans cr)) (cs (nth col-spans cc)))
         (for/fold ((gg out)) ((p (third marker)))
           (let ((r2 (+ (first rr) (first p)))
                 (c2 (+ (first cs) (second p))))
             (if (and (<= r2 (second rr)) (<= c2 (second cs)))
                 (set-cell gg r2 c2 (third p))
                 gg))))))))

Provenance

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