← a53fa114c4a9 · a5ad56f1e9d4 →
a55c1997c5e3
Treat each exact red/cyan 2x2 block as a visibility-graph node. Starting at the unique red block, choose the longest simple orthogonal visibility path; break equal-length ties lexicographically by right, down, left, up, then paint orange corridors only between consecutive chosen nodes.
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!
;; 2x2 blocks are nodes: the red(2) one is the start, cyan(8) the
;; rest. Two nodes connect when axis-aligned with no node between.
;; Walk the LONGEST simple path from the start (ties broken by
;; direction priority right, down, left, up) and pave orange(7)
;; corridors between consecutive nodes.
(lambda (g)
(let ()
(define (block? r c) ;; top-left corner of a 2x2 block
(let ((v (at g r c)))
(and (or (= v 2) (= v 8))
(= (at g r (+ c 1)) v)
(= (at g (+ r 1) c) v)
(= (at g (+ r 1) (+ c 1)) v)
(or (zero? r)
(not (and (= (at g (- r 1) c) v)
(= (at g (- r 1) (+ c 1)) v))))
(or (zero? c)
(not (and (= (at g r (- c 1)) v)
(= (at g (+ r 1) (- c 1)) v)))))))
(define nodes
(for*/list ((r (range 0 (- h 1))) (c (range 0 (- w 1)))
#:when (block? r c))
(list r c (at g r c))))
(define start (find-first (lambda (n) (= (third n) 2)) nodes))
(define (between? x a b) (and (> x (min a b)) (< x (max a b))))
(define (adjacent? a b) ;; same line of sight, nothing between
(or (and (= (first a) (first b))
(not (any? (lambda (n)
(and (not (equal? n a)) (not (equal? n b))
(= (first n) (first a))
(between? (second n) (second a)
(second b))))
nodes)))
(and (= (second a) (second b))
(not (any? (lambda (n)
(and (not (equal? n a)) (not (equal? n b))
(= (second n) (second a))
(between? (first n) (first a)
(first b))))
nodes)))))
(define (dir-priority a b) ;; right 0, down 1, left 2, up 3
(cond ((= (first a) (first b))
(if (< (second a) (second b)) 0 2))
((< (first a) (first b)) 1)
(else 3)))
(define (dir-list path)
(if (or (empty? path) (empty? (rest path)))
(list)
(cons (dir-priority (first path) (second path))
(dir-list (rest path)))))
(define (lex-less? xs ys)
(cond ((empty? xs) #f)
((< (first xs) (first ys)) #t)
((> (first xs) (first ys)) #f)
(else (lex-less? (rest xs) (rest ys)))))
(define (better-path? a b)
(cond ((> (length a) (length b)) #t)
((< (length a) (length b)) #f)
(else (lex-less? (dir-list a) (dir-list b)))))
(define (best-path-from current visited) ;; exhaustive DFS
(let ((candidates
(map (lambda (n)
(cons current
(best-path-from n (cons n visited))))
(filter (lambda (n)
(and (not (member n visited))
(adjacent? current n)
(not (equal? n current))))
nodes))))
(if (empty? candidates)
(list current)
(first (sort candidates better-path?)))))
(define (corridor out a b) ;; orange fill between two blocks
(cond ((= (first a) (first b))
(for*/fold ((acc out))
((rr (range (first a) (+ (first a) 2)))
(cc (range (+ (min (second a) (second b)) 2)
(max (second a) (second b)))))
(set-cell acc rr cc 7)))
((= (second a) (second b))
(for*/fold ((acc out))
((rr (range (+ (min (first a) (first b)) 2)
(max (first a) (first b))))
(cc (range (second a) (+ (second a) 2))))
(set-cell acc rr cc 7)))
(else out)))
(let loop ((path (best-path-from start (list start))) (out g))
(if (or (empty? path) (empty? (rest path)))
out
(loop (rest path)
(corridor out (first path) (second path))))))))Provenance
- Generator
- generators/a55c1997c5e3/generator.py
- Notes and decisions
- generators/a55c1997c5e3/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- 195743d1f77b6928ded4de8eabf5d6ebb27434b46a11c52cd895547219147779
- Rule hash
- d24e861b64b5
- Sources
- training
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate a55c1997c5e3 --count 1 --seed 20261108 --test 1