← 004ca3500787 · 00a3a71adae9 →
0083f06314c3
Four color-9-separated panels contain template A, template B, a selector, and a search board. Selector color 2 chooses A; any other selector color chooses B. Crop the chosen template, match its nonzero cells in the board in the original orientation and exact colors (crop zeros are wildcards), then recolor the union of all matching template cells to 8.
parametric familymulti-template inputs, selector metadata, conditional search
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 (split-cols-9 grid) (let loop ((c 0) (start 0) (acc (list))) (cond ((>= c (cols grid)) (reverse (if (< start (cols grid)) (cons (subgrid grid 0 start (- (rows grid) 1) (- (cols grid) 1)) acc) acc))) ((all? (lambda (r) (= (at grid r c) 9)) (range 0 (rows grid))) (let scan ((cc c)) (if (and (< cc (cols grid)) (all? (lambda (r) (= (at grid r cc) 9)) (range 0 (rows grid)))) (scan (+ cc 1)) (loop cc cc (if (< start c) (cons (subgrid grid 0 start (- (rows grid) 1) (- c 1)) acc) acc))))) (else (loop (+ c 1) start acc))))) (define (crop-nonzero grid) (let ((cells (filter (lambda (p) (let ((v (at grid (first p) (second p)))) (and (not (= v 0)) (not (= v 9))))) (grid-positions grid)))) (if (empty? cells) (grid (list 0)) (let ((bb (bbox-of-cells cells))) (subgrid grid (first bb) (second bb) (third bb) (fourth bb)))))) (define (rot270 grid) (rotate-cw (rotate-180 grid))) (define (variant-grids grid mode) (cond ((= mode 0) (list grid)) ((= mode 1) (list grid (rotate-cw grid) (rotate-180 grid) (rot270 grid))) (else (remove-duplicates (list grid (rotate-cw grid) (rotate-180 grid) (rot270 grid) (flip-lr grid) (rotate-cw (flip-lr grid)) (rotate-180 (flip-lr grid)) (rot270 (flip-lr grid))))))) (define (match-at? board template r c) (all? (lambda (p) (let ((tv (at template (first p) (second p)))) (or (= tv 0) (= (at board (+ r (first p)) (+ c (second p))) tv)))) (grid-positions template))) (define (find-matches board template mode) (flatmap (lambda (t) (for*/list ((r (in-range 0 (+ 1 (- (rows board) (rows t))))) (c (in-range 0 (+ 1 (- (cols board) (cols t))))) #:when (match-at? board t r c)) (list r c t))) (variant-grids template mode))) (define (render-board h w cells (color 8)) (paint-cells (empty-grid h w 0) (filter (lambda (p) (in-bounds? (first p) (second p) h w)) (remove-duplicates cells)) color)) (define (match-nonzero-cells match) (let ((r0 (first match)) (c0 (second match)) (t (third match))) (map (lambda (p) (list (+ r0 (first p)) (+ c0 (second p)))) (filter (lambda (p) (not (= (at t (first p) (second p)) 0))) (grid-positions t))))) (define (board-union-matches board matches (color 8)) (render-board (rows board) (cols board) (flatmap match-nonzero-cells matches) color)) (let* ((panels (split-cols-9 g)) (t1 (crop-nonzero (first panels))) (t2 (crop-nonzero (second panels))) (color (third (first (filter (lambda (cell) (not (= (third cell) 0))) (grid-cells (third panels)))))) (board (fourth panels)) (template (if (= color 2) t1 t2))) (board-union-matches board (find-matches board template 0) 8))))
Provenance
- Generator
- generators/0083f06314c3/generator.py
- Notes and decisions
- generators/0083f06314c3/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- fee152a77b997f9a0bf46fabf890cdd3f5d8de027591586357b40c054c187fb5
- Rule hash
- 6a4eb398052b
- Sources
- bank:9da77d17d00f
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate 0083f06314c3 --count 1 --seed 20261108 --test 1