← b9d1d323c3ed · ba090ac77d54 →

b9e736518d82

A simple 2..6-turn orthogonal channel reaches two grid boundaries and is enclosed by exact orange side walls plus the outer corner at every bend. Examples cycle through no marker, a straight maroon marker, and a marker at a turn. The authority fills the selected channel cyan: all of it for no/straight markers, or only the larger side when a turn marker splits it.

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* ((positions (grid-positions g))
                (adj-orange (filter (lambda (p)
                                      (let ((r (first p))
                                            (c (second p))
                                            (v (at g (first p) (second p))))
                                        (and
                                          (or (= v 0) (= v 9))
                                          (for/or ((d cardinal-deltas))
                                                  (let ((nr (+ r (first d)))
                                                        (nc (+ c (second d))))
                                                    (and
                                                      (in-bounds? nr nc h w)
                                                      (= (at g nr nc) 7)))))))
                                    positions))
                (marker (find (lambda (p) (= (at g (first p) (second p)) 9)) adj-orange))
                (bfs-from (lambda (start pool)
                            (let bfs
                                 ((queue (list start)) (visited (list start)))
                                 (if (null? queue)
                                     visited
                                     (let* ((cur (first queue))
                                            (nbrs (filter (lambda (n)
                                                            (and
                                                              (member? n pool)
                                                              (not (member? n visited))))
                                                          (list (list (- (first cur) 1)
                                                                      (second cur))
                                                                (list (+ (first cur) 1)
                                                                      (second cur))
                                                                (list (first cur)
                                                                      (- (second cur) 1))
                                                                (list (first cur)
                                                                      (+ (second cur) 1))))))
                                       (bfs (append (rest queue) nbrs)
                                            (append visited nbrs)))))))
                (channel (if marker
                             (bfs-from marker adj-orange)
                             (let* ((comp1 (bfs-from (first adj-orange) adj-orange))
                                    (remaining (filter (lambda (p)
                                                         (not (member? p comp1)))
                                                       adj-orange)))
                               (if (null? remaining)
                                   comp1
                                   (let ((comp2 (bfs-from (first remaining) adj-orange)))
                                     (if (> (length comp1) (length comp2)) comp1 comp2))))))
                (fill-cells (if (not marker)
                                channel
                                (let* ((mr (first marker))
                                       (mc (second marker))
                                       (ch-nbrs (filter (lambda (n) (member? n channel))
                                                        (list (list (- mr 1) mc)
                                                              (list (+ mr 1) mc)
                                                              (list mr (- mc 1))
                                                              (list mr (+ mc 1)))))
                                       (same-col (all? (lambda (n) (= (second n) mc))
                                                       ch-nbrs))
                                       (same-row (all? (lambda (n) (= (first n) mr))
                                                       ch-nbrs)))
                                  (if (or same-col same-row)
                                      channel
                                      (let* ((ch-no-m (filter (lambda (c2)
                                                                (not (and
                                                                       (= (first c2) mr)
                                                                       (= (second c2)
                                                                          mc))))
                                                              channel))
                                             (half1 (bfs-from (first ch-no-m) ch-no-m))
                                             (half2 (filter (lambda (p)
                                                              (not (member? p half1)))
                                                            ch-no-m)))
                                        (if (> (length half1) (length half2))
                                            half1
                                            half2)))))))
           (reduce (lambda (gg p) (set-cell gg (first p) (second p) 8)) g fill-cells))))

Provenance

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