← 57df2ac388cd · 586db18f9bd7 →

581bb11ff645

Sort complete separator-delimited red column groups into their original slots by increasing zero-hole count.

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))
                (groups (list))
                (in-grp #f)
                (start 0))
           (for ((c (range 0 w)))
             (let* ((has-red (for/or ((r (range 0 h))) (= (at g r c) 2))))
               (cond
                 ((and has-red (not in-grp)) (set! start c) (set! in-grp #t))
                 ((and (not has-red) in-grp) (set! groups (append groups (list (list start (- c 1)))))
                   (set! in-grp #f)))))
           (when in-grp (set! groups (append groups (list (list start (- w 1))))))
           (let* ((group-data (for/list ((grp groups))
                                (let* ((c1 (first grp))
                                       (c2 (second grp))
                                       (holes (for/sum ((r (range 0 h)))
                                                (for/sum ((c (range c1 (+ c2 1))))
                                                  (if (zero? (at g r c)) 1 0)))))
                                  (list holes c1 c2))))
                  (sorted (sort group-data (lambda (a b) (< (first a) (first b)))))
                  (result (make-hash)))
             (for* ((r (range 0 h)) (c (range 0 w))) (hash-set! result (list r c) 0))
             (for ((i (range 0 (length sorted))))
               (let* ((entry (list-ref sorted i))
                      (src-c1 (second entry))
                      (src-c2 (third entry))
                      (gwidth (+ 1 (- src-c2 src-c1)))
                      (dest-grp (list-ref groups i))
                      (dst-c1 (first dest-grp)))
                 (for* ((r (range 0 h)) (dc (range 0 gwidth)))
                       (hash-set! result (list r (+ dst-c1 dc)) (at g r (+ src-c1 dc))))))
             (cellmap g (r c v) (hash-ref result (list r c) 0))))))

Provenance

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