← 5e8e4691afde · 5ee8de1860a7 →
5ec933db2c3a
A colour-9 column separates a 3x3 template in colours 2 and 7 from a larger board. Consider all four rotations of the template. Complete only windows with exactly two missing occupied cells, restoring each missing cell with the corresponding template colour; leave one-hole, three-hole, wrong-colour, and extra-mark windows unchanged. Return the board alone.
rotation-tolerant near-match detection, multi-hole repair, local completion
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 (missing-required board t r c) (filter (lambda (p) (let ((tv (at t (first p) (second p))) (bv (at board (+ r (first p)) (+ c (second p))))) (and (not (= tv 0)) (not (= tv bv)) (= bv 0)))) (grid-positions t))) (define (required-compatible? board t r c) (all? (lambda (p) (let ((tv (at t (first p) (second p))) (bv (at board (+ r (first p)) (+ c (second p))))) (or (= tv 0) (= tv bv) (= bv 0)))) (grid-positions t))) (define (template-zero-clear? board t r c) (all? (lambda (p) (or (not (= (at t (first p) (second p)) 0)) (= (at board (+ r (first p)) (+ c (second p))) 0))) (grid-positions t))) (define (near-match? board t r c holes) (and (required-compatible? board t r c) (template-zero-clear? board t r c) (= (length (missing-required board t r c)) holes))) (define (exact-or-hole-matches board template mode holes) (flatmap (lambda (t) (for*/list ((r (in-range 0 (+ 1 (- (rows board) (rows t))))) (c (in-range 0 (+ 1 (- (cols board) (cols t))))) #:when (near-match? board t r c holes)) (list r c t (map (lambda (p) (list (+ r (first p)) (+ c (second p)) (at t (first p) (second p)))) (missing-required board t r c))))) (variant-grids template mode))) (let* ((panels (split-cols-9 g)) (template (crop-nonzero (first panels))) (board (second panels)) (matches (exact-or-hole-matches board template 1 2))) (for/fold ((out board)) ((m (in-list matches))) (for/fold ((acc out)) ((miss (in-list (fourth m)))) (set-cell acc (first miss) (second miss) (third miss)))))))
Provenance
- Generator
- generators/5ec933db2c3a/generator.py
- Notes and decisions
- generators/5ec933db2c3a/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- 32378ad32e0d4ab2500adf5792c024646274dd32b46364185e7521b7cd1d9315
- Rule hash
- 009a49ded011
- Sources
- bank:9da77d17d00f
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate 5ec933db2c3a --count 1 --seed 20261108 --test 1