← d3ace3f5d190 · d3c9fc4479d8 →

d3ae93aa8d37

Exactly one red start and one green goal lie on a 6-30 square/rectangular zero canvas with optional gray walls. The canonical BFS paints only the interior of a shortest wall-avoiding orthogonal path cyan. Four scheduled profiles guarantee obstacle-relevant teaching support in every lesson.

parametric family

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 (pos-in? p lst)
      (any? (lambda (q) (same-pos? p q)) lst))
    (define (parent-of p parents)
      (let ((hit (find-first (lambda (entry) (same-pos? p (first entry))) parents)))
        (if hit (second hit) #f)))
    (define (reconstruct goal parents)
      (let loop ((cur goal) (acc (list)))
        (let ((prev (parent-of cur parents)))
          (if prev
              (loop prev (cons cur acc))
              (cons cur acc)))))
    (define (shortest-path start goal)
      (let loop ((visited (list))
                 (queue (list start))
                 (parents (list (list start #f))))
        (if (empty? queue)
            (list)
            (let ((cur (first queue))
                  (restq (cdr queue)))
              (cond
                [(pos-in? cur visited) (loop visited restq parents)]
                [(same-pos? cur goal) (reconstruct goal parents)]
                [else
                 (let* ((new-visited (cons cur visited))
                        (r (fst cur))
                        (c (snd cur))
                        (neighbors
                          (filter
                            (lambda (n)
                              (let ((nr (fst n)) (nc (snd n)))
                                (and (in-bounds? nr nc h w)
                                     (not (= (cell-at g nr nc) 5))
                                     (not (pos-in? n new-visited))
                                     (not (pos-in? n restq)))))
                            (map
                              (lambda (d) (list (+ r (fst d)) (+ c (snd d))))
                              cardinal-deltas))))
                   (loop new-visited
                         (append restq neighbors)
                         (append parents (map (lambda (n) (list n cur)) neighbors))))])))))
    (let* ((start (first (find-color g 2)))
           (goal (first (find-color g 3)))
           (path (shortest-path start goal))
           (interior
             (filter
               (lambda (p) (not (or (same-pos? p start) (same-pos? p goal))))
               path)))
      (paint-cells g interior 8))))

Provenance

Generator
generators/d3ae93aa8d37/generator.py
Notes and decisions
generators/d3ae93aa8d37/notes.md
Review label
reviewed_safe
Generator SHA-256
b61450e36f6d3f375e7f88f5fa17f5c31f6bbadcf71b4e9ffd80af56eb278f90
Rule hash
01f433c4866f
Sources
bank:e2825ca16ace
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate d3ae93aa8d37 --count 1 --seed 20261108 --test 1