← 20014c9d3729 · 2038a3a66886 →

2006f915df8b

Trace a shortest four-neighbor route from red 2 to green 3 through cells other than gray walls 5. The unchanged Racket rule colors only the route's zero-valued interior cells cyan 8. Three demonstrations mix competing-route witnesses with varied lattice mazes, branches and loops.

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* ((start (first (find-color g 2)))
         (goal (first (find-color g 3))))
    (define parent (make-hash))
    (define seen (make-hash))
    (define queue (list (cons (first start) (second start))))
    (define goal-key (cons (first goal) (second goal)))
    (define found #f)
    (hash-set! seen (first queue) #t)
    (let bfs ([step 0])
      (unless (or found (empty? queue))
        (let ((cur (first queue)))
          (set! queue (rest queue))
          (when (equal? cur goal-key) (set! found #t))
          (unless found
            (for ([d (in-list cardinal-deltas)])
              (let ((nr (+ (car cur) (first d)))
                    (nc (+ (cdr cur) (second d))))
                (when (and (in-bounds? nr nc (rows g) (cols g))
                           (not (hash-has-key? seen (cons nr nc)))
                           (not (= (at g nr nc) 5)))
                  (hash-set! seen (cons nr nc) #t)
                  (hash-set! parent (cons nr nc) cur)
                  (set! queue (append queue (list (cons nr nc)))))))))
        (bfs (+ step 1))))
    (if (not found)
        g
        (let trace ([cur goal-key] [path (list)])
          (if (equal? cur (cons (first start) (second start)))
              (foldl (lambda (p out)
                       (if (= (at g (first p) (second p)) 0)
                           (set-cell out (first p) (second p) 8)
                           out))
                     g
                     path)
              (trace (hash-ref parent cur) (cons (list (car cur) (cdr cur)) path)))))))

Provenance

Generator
generators/2006f915df8b/generator.py
Notes and decisions
generators/2006f915df8b/notes.md
Review label
reviewed_safe
Generator SHA-256
f574a02ff6155f62ad28562f6af217ddbc0bb8e4d41522c73e27b569eb7c7472
Rule hash
24791e9d8fc8
Sources
bank:d3d681cdb82a
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 2006f915df8b --count 1 --seed 20261108 --test 1