← 346c1552c4eb · 34abaec056ef →
348efda982ab
Walls partition the input into rooms. Doors (7) induce adjacency edges; green markers (3) are counted per room. Paint a whole room cyan (8) iff its marker count equals its number of neighboring rooms.
mixed local/global reasoning, graph degree, roomwise selection
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 (wall? v) (member? v (list 1 7 9))) (define (make-room id cells) (let* ((bb (bbox-of-cells cells)) (r (first bb)) (c (second bb)) (h (+ 1 (- (third bb) r))) (w (+ 1 (- (fourth bb) c)))) (list id cells (list r c h w)))) (define (room-id room) (first room)) (define (room-cells room) (second room)) (define (extract-room-data grid) (define seen (make-hash)) (define cell-to-rid (make-hash)) (define rooms (list)) (for* ((r (in-range (rows grid))) (c (in-range (cols grid)))) (when (and (not (wall? (at grid r c))) (not (hash-has-key? seen (list r c)))) (define cells (connected-region grid r c (lambda (rr cc v) (not (wall? v))) 4)) (define id (length rooms)) (for ((p (in-list cells))) (hash-set! seen p #t) (hash-set! cell-to-rid p id)) (set! rooms (append rooms (list (make-room id cells)))))) (list rooms cell-to-rid)) (define (room-graph grid) (let* ((data (extract-room-data grid)) (rooms (first data)) (cell-to-rid (second data)) (adj (make-hash))) (for ((room (in-list rooms))) (hash-set! adj (room-id room) (list))) (define (add-edge a b) (hash-set! adj a (sort (remove-duplicates (cons b (hash-ref adj a (list)))) <)) (hash-set! adj b (sort (remove-duplicates (cons a (hash-ref adj b (list)))) <))) (for* ((r (in-range (rows grid))) (c (in-range (cols grid)))) (when (= (at grid r c) 7) (define ids (remove-duplicates (filter number? (map (lambda (d) (hash-ref cell-to-rid (list (+ r (first d)) (+ c (second d))) #f)) cardinal-deltas)))) (for* ((a (in-list ids)) (col (in-list ids))) (when (< a col) (add-edge a col))))) (list rooms adj cell-to-rid))) (define (walls-grid grid) (grid-from-fn (rows grid) (cols grid) (lambda (r c) (if (wall? (at grid r c)) (at grid r c) 0)))) (define (paint-room out room color) (paint-cells out (room-cells room) color)) (let* ((rg (room-graph g)) (rooms (first rg)) (adj (second rg))) (for/fold ((out (walls-grid g))) ((room (in-list rooms))) (let ((cnt (count-where (lambda (p) (= (at g (first p) (second p)) 3)) (room-cells room))) (deg (length (hash-ref adj (room-id room))))) (if (= cnt deg) (paint-room out room 8) out))))))
Provenance
- Generator
- generators/348efda982ab/generator.py
- Notes and decisions
- generators/348efda982ab/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- fb4f64c5f0eaed86b2d52d15f2f90739ba02ac358c0078f73b591cae76ec8cdf
- Rule hash
- abbcb1f89b47
- Sources
- bank:445ef4275a64
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate 348efda982ab --count 1 --seed 20261108 --test 1