← b5c887448ed9 · b6452f922704 →

b5df32f2dc17

For each row independently, extract every monochrome nonzero run, sort those runs by descending length, preserve each run's color and length, then rebuild the row from column 0 with one 0 separator between runs. Generated lessons combine a genuine sorting witness with already-sorted, single-run, and blank controls so both row-wise scope and left-packing are identifiable rather than inferred from homogeneous rows.

parametric familyline runsrow reconstructionsorting

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).

Reference rule (Racket)

(rule! (let ((dummy 0)) (define (fifth xs) (list-ref xs 4)) (define (list-set xs idx val) (let loop ((rest-xs xs) (i 0)) (if (empty? rest-xs) (list) (cons (if (= i idx) val (first rest-xs)) (loop (rest rest-xs) (+ i 1)))))) (define (row-run r start end color) (list 'row r start end (+ 1 (- end start)) color (for/list ((c (in-range start (+ end 1)))) (list r c)))) (define (run-line run) (second run)) (define (run-start run) (third run)) (define (run-length run) (fifth run)) (define (run-color run) (list-ref run 5)) (define (row-runs grid) (apply append (for/list ((r (in-range (rows grid)))) (let loop ((c 0) (acc (list))) (if (>= c (cols grid)) (reverse acc) (let ((v (at grid r c))) (if (= v 0) (loop (+ c 1) acc) (let find-end ((cc c)) (if (and (< (+ cc 1) (cols grid)) (= (at grid r (+ cc 1)) v)) (find-end (+ cc 1)) (loop (+ cc 1) (cons (row-run r c cc v) acc))))))))))) (for/list ((r (in-range (rows g)))) (let* ((runs (sort (filter (lambda (run) (= (run-line run) r)) (row-runs g)) (lambda (a b) (if (= (run-length a) (run-length b)) (< (run-start a) (run-start b)) (> (run-length a) (run-length b))))))) (let loop ((xs runs) (c 0) (row (make-list (cols g) 0))) (if (empty? xs) row (let* ((run (first xs)) (filled (for/fold ((acc row)) ((i (in-range (run-length run)))) (if (< (+ c i) (cols g)) (list-set acc (+ c i) (run-color run)) acc))) (next-c (+ c (run-length run) (if (empty? (rest xs)) 0 1)))) (loop (rest xs) next-c filled))))))))

Provenance

Generator
generators/b5df32f2dc17/generator.py
Notes and decisions
generators/b5df32f2dc17/notes.md
Review label
reviewed_safe
Generator SHA-256
618fff41de2f61b0f4e2764be354142f6eb9f51645713ecb1f6ce2a03ff19c93
Rule hash
5afe989c75c5
Sources
bank:02cfd661bb19
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate b5df32f2dc17 --count 1 --seed 20261108 --test 1