← public_eval_b99e7126 · public_eval_bf45cf4b →

public_eval_b9e38dc0

Continue a nozzle's stepped walls, identify its dye, and fill the inferred band while preserving parallel obstacle shadows.

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!
 (let* ((opaque #t)
        (bg (mode g -1))
        (wall (mode g bg))
        (wall-cells (lambda (h) (filter (lambda (p) (= (at h (first p) (second p)) wall))
                                      (grid-positions h))))
        (adjacent (lambda (p points)
                    (filter (lambda (q)
                              (and (not (equal? p q))
                                   (<= (abs (- (first p) (first q))) 1)
                                   (<= (abs (- (second p) (second q))) 1))) points)))
        (tips (lambda (points) (filter (lambda (p) (= (length (adjacent p points)) 1)) points)))
        (original-cells (wall-cells g))
        (original-ends (tips original-cells))
        (tangents (map (lambda (p) (let ((q (first (adjacent p original-cells))))
                                    (list (- (first p) (first q)) (- (second p) (second q))))) original-ends))
        (dy (apply + (map first tangents)))
        (dx (apply + (map second tangents)))
        (turns (if (> (abs dy) (abs dx)) (if (> dy 0) 0 2) (if (> dx 0) 1 3)))
        (turn (lambda (h n) (foldl (lambda (unused acc) (rotate-cw acc)) h (range n))))
        (base (turn g turns))
        (cells (wall-cells base))
        (ends (sort (tips cells) (lambda (a b) (< (second a) (second b)))))
        (records
          (map (lambda (p side)
                 (let* ((r (first p)) (c (second p))
                        (missing (filter (lambda (y) (not (member? (list y c) cells))) (range r)))
                        (start (+ 1 (apply max (cons -1 missing))))
                        (stride (+ 1 (- r start))))
                   (list r c stride side))) ends '(-1 1)))
        (cap-row (apply min (map first cells)))
        (edge-at
          (lambda (r record)
            (let ((end-r (first record)) (end-c (second record))
                  (stride (third record)) (side (fourth record)))
              (if (> r end-r)
                  (+ end-c (* side (quotient (+ (- r end-r) stride -1) stride)))
                  (apply (if (= side -1) min max)
                         (map second (filter (lambda (p) (= (first p) r)) cells)))))))
        (inside
          (filter (lambda (p)
                    (let ((r (first p)) (c (second p)))
                      (and (> r cap-row)
                           (< (edge-at r (first records)) c (edge-at r (second records)))
                           (not (member? p cells))))) (grid-positions base)))
        (markers (filter (lambda (p) (not (= (at base (first p) (second p)) bg))) inside))
        (first-marker (first (sort markers
                               (lambda (a b) (if (= (first a) (first b)) (< (second a) (second b))
                                                 (< (first a) (first b)))))))
        (dye (at base (first first-marker) (second first-marker)))
        (blockers (filter (lambda (p) (not (= (at base (first p) (second p)) dye))) markers))
        (frontiers (for/list ((c (in-range (cols base))))
                     (apply min (cons (rows base)
                                 (map first (filter (lambda (p) (= (second p) c)) blockers))))))
        (painted
          (grid-from-fn (rows base) (cols base)
            (lambda (r c)
              (if (and (= (at base r c) bg)
                       (member? (list r c) inside)
                       (or (not opaque) (<= r (list-ref frontiers c))))
                  dye (at base r c))))))
   (turn painted (modulo (- 4 turns) 4))))

Provenance

Generator
generators/public_eval_b9e38dc0/generator.py
Notes and decisions
generators/public_eval_b9e38dc0/notes.md
Review label
reviewed_safe
Generator SHA-256
781a650c699ad4645b8bd550f5cd0e2390adeb75c0199c2fafe309e7290dc56a
Rule hash
2819124fd538
Sources
evaluation, public_eval:b9e38dc0
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate public_eval_b9e38dc0 --count 1 --seed 20261108 --test 1