← 50b472d4fc63 · 510b12f6a12a →

50e0af791608

Highlight the union of every shortest red-to-green path through a gray-walled maze.

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 (dist-from start)
      (define dist (make-hash))
      (define queue (list (cons (first start) (second start))))
      (hash-set! dist (first queue) 0)
      (let bfs ([fuel 0])
        (unless (empty? queue)
          (let ((cur (first queue)))
            (set! queue (rest queue))
            (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 (= (at g nr nc) 5))
                           (not (hash-has-key? dist (cons nr nc))))
                  (hash-set! dist (cons nr nc) (+ (hash-ref dist cur) 1))
                  (set! queue (append queue (list (cons nr nc))))))))
          (bfs (+ fuel 1))))
      dist)
    (define ds (dist-from start))
    (define dg (dist-from goal))
    (define D (hash-ref ds (cons (first goal) (second goal)) 999999))
    (grid-from-fn (rows g) (cols g)
      (lambda (r c)
        (if (and (= (at g r c) 0)
                 (< D 999999)
                 (hash-has-key? ds (cons r c))
                 (hash-has-key? dg (cons r c))
                 (= (+ (hash-ref ds (cons r c)) (hash-ref dg (cons r c))) D))
            8
            (at g r c))))))

Provenance

Generator
generators/50e0af791608/generator.py
Notes and decisions
generators/50e0af791608/notes.md
Review label
reviewed_safe
Generator SHA-256
b953acb9cdd719a06c76b65028d3c81af30b30914fbb81f1cba08c3d6df5da12
Rule hash
f0c150157293
Sources
bank:343f662c728a
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 50e0af791608 --count 1 --seed 20261108 --test 1