← 907bb29fbac5 · 90fdcc9074f8 →

90e1b47a15f9

In a color-8 maze, trace the shortest lawful path from start 2 to goal 3 in (position, key-4-held, key-5-held) state space. Key 4 unlocks door 6 and key 5 unlocks door 7. Paint every path coordinate 9 on an otherwise zero grid; return all zeros when the goal is unreachable.

pathfindingsame_sizestate

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 start (first (find-color g 2))) (define goal (first (find-color g 3))) (define start-state (list (first start) (second start) 0 0)) (define prev (make-hash)) (define queue (list start-state)) (define end-state #f) (hash-set! prev start-state #f) (define (passable nr nc ka kb) (and (in-bounds? nr nc (rows g) (cols g)) (not (= (at g nr nc) 8)) (or (not (= (at g nr nc) 6)) (= ka 1)) (or (not (= (at g nr nc) 7)) (= kb 1)))) (define (bfs) (unless (or end-state (empty? queue)) (define st (first queue)) (set! queue (rest queue)) (define r (first st)) (define c (second st)) (define ka (third st)) (define kb (fourth st)) (if (and (= r (first goal)) (= c (second goal))) (set! end-state st) (let ((nka (if (= (at g r c) 4) 1 ka)) (nkb (if (= (at g r c) 5) 1 kb))) (if (and (not (and (= nka ka) (= nkb kb))) (not (hash-has-key? prev (list r c nka nkb)))) (begin (hash-set! prev (list r c nka nkb) st) (set! queue (cons (list r c nka nkb) queue))) (for ((d (in-list cardinal-deltas))) (define nr (+ r (first d))) (define nc (+ c (second d))) (when (passable nr nc nka nkb) (define ns (list nr nc nka nkb)) (unless (hash-has-key? prev ns) (hash-set! prev ns st) (set! queue (append queue (list ns))))))))) (bfs))) (bfs) (if (not end-state) (empty-grid (rows g) (cols g) 0) (let rebuild ((cur end-state) (out (empty-grid (rows g) (cols g) 0))) (if (eq? cur #f) out (rebuild (hash-ref prev cur #f) (set-cell out (first cur) (second cur) 9)))))))

Provenance

Generator
generators/90e1b47a15f9/generator.py
Notes and decisions
generators/90e1b47a15f9/notes.md
Review label
reviewed_safe
Generator SHA-256
25c0279e274f54e6f706b65c4aae39a77fcbe2693831d5ec5c2314926d7a6aee
Rule hash
e59742fe2660
Sources
bank:cedcb02251c0
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 90e1b47a15f9 --count 1 --seed 20261108 --test 1