← 2c4efc97c37d · 2c6496d261a6 →
2c631747784e
On a cyan-8 background, find the single non-branching 4-connected path. Walk from either endpoint, reverse the encountered color sequence, and repaint those same coordinates in the reversed order.
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! (lambda (g)
(let* ((h (rows g))
(w (cols g))
(bg 8)
;; The non-cyan cells are one unbranched path. Find its cells and
;; choose either degree-one endpoint as the traversal start.
(cells
(for*/list ((r (range 0 h))
(c (range 0 w))
#:when (not (= (cell-at g r c) bg)))
(list r c)))
(cell-set (make-hash))
(seed-cell-set
(for ((cell cells))
(hash-set! cell-set cell #t)))
(start #f)
(find-endpoint
(for ((cell cells))
(let ((degree
(count-if
(lambda (neighbor) (hash-has-key? cell-set neighbor))
(list (list (- (first cell) 1) (second cell))
(list (+ (first cell) 1) (second cell))
(list (first cell) (- (second cell) 1))
(list (first cell) (+ (second cell) 1))))))
(when (and (not start) (= degree 1))
(set! start cell)))))
;; Trace the unique path and collect its positions in endpoint order.
(path (list))
(visited (make-hash))
(trace-path
(let trace ((current start))
(when (and current
(hash-has-key? cell-set current)
(not (hash-has-key? visited current)))
(hash-set! visited current #t)
(set! path (append path (list current)))
(let ((next
(find
(lambda (neighbor)
(and (hash-has-key? cell-set neighbor)
(not (hash-has-key? visited neighbor))))
(list (list (- (first current) 1) (second current))
(list (+ (first current) 1) (second current))
(list (first current) (- (second current) 1))
(list (first current) (+ (second current) 1))))))
(trace next)))))
;; Reverse only the color sequence; every path coordinate is retained.
(path-colors
(map (lambda (position)
(cell-at g (first position) (second position)))
path))
(reversed-colors (reverse path-colors))
(result (make-hash)))
(for* ((r (range 0 h)) (c (range 0 w)))
(hash-set! result (list r c) bg))
(for ((i (range 0 (length path))))
(hash-set! result (list-ref path i) (list-ref reversed-colors i)))
(grid-from-fn h w
(lambda (r c) (hash-ref result (list r c) bg))))))Provenance
- Generator
- generators/2c631747784e/generator.py
- Notes and decisions
- generators/2c631747784e/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- 3ad4bb9784a8520161d14edac52ec73de6c4d7d6dd757e287ee676e87ab10f11
- Rule hash
- 1b96d7f1e866
- Sources
- augmented, training
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate 2c631747784e --count 1 --seed 20261108 --test 1