← 6f6c567e365b · 6fde852adb54 →

6fc2f51cfbb2

A gray(5) field contains one connected network of walkable zero-cells, one red(2) start, and one green(3) goal. Some scenes contain a single cycle that supplies exactly two equal-length shortest routes; others contain a unique elbow route plus dead-end branches. Treat gray cells as walls. Of all shortest 4-connected start-to-goal paths, recolor with cyan(8) exactly the zero-cells present on every shortest path. Preserve the red and green endpoints, alternative shortest-route cells, dead-end branches, and walls.

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 ((dummy 0))
    (define (same-pos? a b)
      (and (= (fst a) (fst b)) (= (snd a) (snd b))))
    (define (record-of p records)
      (find-first (lambda (rec) (same-pos? p (first rec))) records))
    (define (set-record-count p new-count records)
      (map
        (lambda (rec)
          (if (same-pos? p (first rec))
              (list (first rec) (second rec) new-count)
              rec))
        records))
    (define (neighbors p)
      (filter
        (lambda (n)
          (let ((nr (fst n)) (nc (snd n)))
            (and (in-bounds? nr nc h w) (not (= (cell-at g nr nc) 5)))))
        (map (lambda (d) (list (+ (fst p) (fst d)) (+ (snd p) (snd d)))) cardinal-deltas)))
    (define (dist-count start)
      (let loop ((queue (list start)) (records (list (list start 0 1))))
        (if (empty? queue)
            records
            (let* ((cur (first queue))
                   (restq (cdr queue))
                   (cur-rec (record-of cur records))
                   (cur-dist (second cur-rec))
                   (cur-count (third cur-rec)))
              (let update ((ns (neighbors cur)) (q restq) (recs records))
                (if (empty? ns)
                    (loop q recs)
                    (let* ((n (first ns))
                           (nd (+ cur-dist 1))
                           (hit (record-of n recs)))
                      (cond
                        [(not hit)
                         (update (cdr ns) (append q (list n)) (append recs (list (list n nd cur-count))))]
                        [(= (second hit) nd)
                         (update (cdr ns) q (set-record-count n (+ (third hit) cur-count) recs))]
                        [else (update (cdr ns) q recs)]))))))))
    (let* ((start (first (find-color g 2)))
           (goal (first (find-color g 3)))
           (from-start (dist-count start))
           (from-goal (dist-count goal))
           (goal-rec (record-of goal from-start)))
      (if (not goal-rec)
          g
          (let ((D (second goal-rec))
                (total (third goal-rec)))
            (grid-from-fn h w
              (lambda (r c)
                (let* ((v (cell-at g r c))
                       (p (list r c))
                       (rs (record-of p from-start))
                       (rg (record-of p from-goal)))
                  (if (and (not (= v 5)) (not (= v 2)) (not (= v 3))
                           rs rg (= (+ (second rs) (second rg)) D)
                           (= (* (third rs) (third rg)) total))
                      8
                      v)))))))))

Provenance

Generator
generators/6fc2f51cfbb2/generator.py
Notes and decisions
generators/6fc2f51cfbb2/notes.md
Review label
reviewed_safe
Generator SHA-256
bcc983b4cc202db6eb364b5846253bfd563b9f58efb0d5d3fe6b354a1969decb
Rule hash
d2ecbd1c9b9e
Sources
bank:7f8a290afe75
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 6fc2f51cfbb2 --count 1 --seed 20261108 --test 1