← 1acd7639146e · 1b39c0e8ebc7 →
1b2b9283b4ab
Rectangular rooms are joined only by 7-doorways through 1/9 walls. Fill rooms with the nearest seed-room color in graph distance; use 8 for equal nearest distinct colors. Multi-color seed rooms use their smallest color. Includes detours, disconnected rooms, repeated seed colors, and contrastive lessons with three demonstrations.
parametric familymulti-source BFS, graph Voronoi reasoning, tie handling
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)) (define (room-colors grid room) (remove-duplicates (filter (lambda (v) (not (= v 0))) (map (lambda (p) (at grid (first p) (second p))) (room-cells room))))) (define (distances adj start) (define queue (list start)) (define dist (make-hash)) (hash-set! dist start 0) (define (search) (unless (empty? queue) (define cur (first queue)) (set! queue (rest queue)) (for ((n (in-list (hash-ref adj cur (list))))) (when (not (hash-has-key? dist n)) (hash-set! dist n (+ (hash-ref dist cur) 1)) (set! queue (append queue (list n))))) (search))) (search) dist) (let* ((rg (room-graph g)) (rooms (first rg)) (adj (second rg)) (seed-entries (filter values (map (lambda (room) (let ((colors (sort (filter (lambda (v) (not (member? v (list 0 1 7 9)))) (room-colors g room)) <))) (if (empty? colors) #f (list (room-id room) (first colors))))) rooms)))) (for/fold ((out (walls-grid g))) ((room (in-list rooms))) (let* ((dist-colors (map (lambda (entry) (let ((dist (distances adj (first entry)))) (list (hash-ref dist (room-id room) 999) (second entry)))) seed-entries)) (bestd (apply min (map first dist-colors))) (best-colors (remove-duplicates (map second (filter (lambda (e) (= (first e) bestd)) dist-colors)))) (fill (if (= (length best-colors) 1) (first best-colors) 8))) (paint-room out room fill))))))
Provenance
- Generator
- generators/1b2b9283b4ab/generator.py
- Notes and decisions
- generators/1b2b9283b4ab/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- b7e78b1eaebfb919f8344017390dfda73beba17146c1cb20e1b170390dcb97ce
- Rule hash
- 3e13418e96c9
- Sources
- bank:445ef4275a64
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate 1b2b9283b4ab --count 1 --seed 20261108 --test 1