← ae0d46c67401 · ae7376fe4957 →

ae148d180b74

Mark every black cell lying on any shortest non-wall path between red and green.

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 (dist-from start)
      (define dist (make-hash))
      (define queue (list start))
      (hash-set! dist start 0)
      (define (bfs)
        (unless (empty? queue)
          (let* ((p (first queue)) (r (first p)) (c (second p)) (d0 (hash-ref dist p)))
            (set! queue (rest queue))
            (for ([d (in-list cardinal-deltas)])
              (let ((nr (+ r (first d))) (nc (+ c (second d))))
                (when (and (in-bounds? nr nc (rows g) (cols g))
                           (not (= (at g nr nc) 5))
                           (not (hash-has-key? dist (list nr nc))))
                  (hash-set! dist (list nr nc) (+ d0 1))
                  (set! queue (append queue (list (list nr nc)))))))
            (bfs))))
      (bfs)
      dist)
    (define s (first (find-color g 2)))
    (define t (first (find-color g 3)))
    (define ds (dist-from s))
    (define dt (dist-from t))
    (if (not (hash-has-key? ds t))
        g
        (let ((target (hash-ref ds t)))
          (foldl (lambda (p out)
                   (if (and (= (at g (first p) (second p)) 0)
                            (hash-has-key? ds p)
                            (hash-has-key? dt p)
                            (= (+ (hash-ref ds p) (hash-ref dt p)) target))
                       (set-cell out (first p) (second p) 8)
                       out))
                 g (grid-positions g))))))

Provenance

Generator
generators/ae148d180b74/generator.py
Notes and decisions
generators/ae148d180b74/notes.md
Review label
reviewed_safe
Generator SHA-256
4963b05aeebef0915c1971222441e38a8b14eeb7688d74537e7078b40ea29fa2
Rule hash
4fb01d27e94e
Sources
bank:3cb9777539c7
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate ae148d180b74 --count 1 --seed 20261108 --test 1