← e706449ebf4c · e777125624ca →

e73c86cb45ad

Top-right target color, one color-1 reference, and two or three equally sized candidates; exactly one candidate is a requested rotation match.

recoloringreference matchingrotation invariance

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 (nonzero-cells grid) (filter (lambda (p) (not (= (at grid (first p) (second p)) 0))) (grid-positions grid))) (define (crop-nonzero grid) (let ((cells (nonzero-cells grid))) (if (empty? cells) (list (list 0)) (let* ((bb (bbox-of-cells cells))) (subgrid grid (first bb) (second bb) (third bb) (fourth bb)))))) (define (e8b-list< a b) (cond ((empty? a) #f) ((< (first a) (first b)) #t) ((> (first a) (first b)) #f) (else (e8b-list< (rest a) (rest b))))) (define (f14b-binary-crop grid) (crop-nonzero (grid-from-fn (rows grid) (cols grid) (lambda (r c) (if (= (at grid r c) 0) 0 1))))) (define (f14b-rotations grid) (let loop ((cur (f14b-binary-crop grid)) (n 0) (acc (list))) (if (= n 4) (remove-duplicates (reverse acc)) (loop (rotate-cw cur) (+ n 1) (cons cur acc))))) (define (s17b-object-crop grid obj) (let ((bb (obj-bbox obj))) (subgrid grid (first bb) (second bb) (third bb) (fourth bb)))) (define (s17b-object< a b) (let ((ba (obj-bbox a)) (bb (obj-bbox b))) (e8b-list< (list (first ba) (second ba)) (list (first bb) (second bb))))) (define (s17b-largest-object objs) (first (sort objs (lambda (a b) (let ((ba (obj-bbox a)) (bb (obj-bbox b))) (or (> (obj-size a) (obj-size b)) (and (= (obj-size a) (obj-size b)) (e8b-list< (list (first ba) (second ba)) (list (first bb) (second bb)))))))))) (define (s17b-recolor grid color) (grid-from-fn (rows grid) (cols grid) (lambda (r c) (if (= (at grid r c) 0) 0 color)))) (define (s17b-same-under-rotation? a b) (member? (f14b-binary-crop a) (f14b-rotations b))) (let* ((target (at g 0 (- (cols g) 1))) (work0 (set-cell g 0 (- (cols g) 1) 0)) (ref (s17b-largest-object (filter (lambda (obj) (= (obj-color obj) 1)) (objects work0 0)))) (ref-obj (s17b-object-crop work0 ref)) (work (paint-cells work0 (obj-cells ref) 0)) (candidates (sort (objects work 0) s17b-object<)) (hit (first (filter (lambda (obj) (s17b-same-under-rotation? ref-obj (s17b-object-crop work obj))) candidates)))) (s17b-recolor (s17b-object-crop work hit) target))))

Provenance

Generator
generators/e73c86cb45ad/generator.py
Notes and decisions
generators/e73c86cb45ad/notes.md
Review label
reviewed_safe
Generator SHA-256
da555463415e9229e5b468864d3d6f5acf67b98cd81ead573204313ee77282c5
Rule hash
a405585a6a23
Sources
bank:f716aa11d181
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate e73c86cb45ad --count 1 --seed 20261108 --test 1