← aea1d569d78b · aea86d2776f1 →

aea4d55345a1

Four equal sections separated by full gray rows show a changing pattern; predict the next section by shifting the latest cell diff and carrying a prior row diff when the latest step skipped that row.

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))
         (seps (filter (lambda (r) (= (at g r 0) 5)) (range 0 h)))
         (sec-h (first seps))
         (starts (append (list 0) (map (lambda (s) (+ s 1)) seps)))
         (ns (length starts))
         (sec (lambda (si)
           (let* ((start (nth starts si)))
             (for/list ((r (range start (+ start sec-h))))
               (for/list ((c (range 0 w))) (at g r c))))))
         (s-last (sec (- ns 1)))
         (s-prev (sec (- ns 2)))
         (s-pprev (sec (- ns 3)))
         ;; Diff: changed cells between two sections
         (diff (lambda (sa sb)
           (filter (lambda (d) d)
             (for*/list ((r (range 0 sec-h)) (c (range 0 w)))
               (let* ((va (nth (nth sa r) c)) (vb (nth (nth sb r) c)))
                 (and (!= va vb) (list r c va vb)))))))
         (d-prev (diff s-pprev s-prev))
         (d-last (diff s-prev s-last))
         (d-last-rows (unique (map first d-last)))
         (carry-diffs (filter (lambda (d) (not (find (lambda (r) (= r (first d))) d-last-rows))) d-prev))
         ;; Column shift between consecutive diffs
         (col-shift (if (or (empty? d-prev) (empty? d-last)) 0
           (- (reduce (lambda (a b) (if (< a b) a b))
                (second (first d-last)) (map second (rest d-last)))
              (reduce (lambda (a b) (if (< a b) a b))
                (second (first d-prev)) (map second (rest d-prev)))))))
    ;; Apply shifted diff to last section
    (grid-from-fn sec-h w (lambda (r c)
      (let* ((m (find (lambda (d) (and (= (first d) r)
              (= (+ (second d) col-shift) c))) d-last))
             (m2 (find (lambda (d)
                  (and (= (first d) r)
                       (> c (second d))
                       (= (nth (nth s-last r) c) (third d))
                       (not (for/or ((cc (range (+ (second d) 1) c)))
                              (= (nth (nth s-last r) cc) (third d))))))
                carry-diffs)))
          (cond
            [(and m (= (nth (nth s-last r) c) (third m))) (fourth m)]
            [m2 (fourth m2)]
            [else (nth (nth s-last r) c)])))))))

Provenance

Generator
generators/aea4d55345a1/generator.py
Notes and decisions
generators/aea4d55345a1/notes.md
Review label
reviewed_safe
Generator SHA-256
577389e1bc9eeab57c4d3851f24f9938f34aab81fc7f3540b833e8e59b970446
Rule hash
3af11f1e6cf1
Sources
training
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate aea4d55345a1 --count 1 --seed 20261108 --test 1