← 50385c1a773f · 506e262f9354 →

504e304a77f1

A zero-background grid contains 2-4 disconnected hollow rectangular frames in one shared colour and the same number of differently coloured ordinary shapes. Frame interior areas and shape cell counts are each strictly increasing. Rank shapes by cell count, rank frames by interior area, erase the old shapes, and centre each shape in its matching frame.

assignmentframesobjectssame_size

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 (obj-bbox-width obj) (+ 1 (- (obj-c2 obj) (obj-c1 obj)))) (define (obj-bbox-height obj) (+ 1 (- (obj-r2 obj) (obj-r1 obj)))) (define (component-grid obj) (for/fold ((out (empty-grid (obj-bbox-height obj) (obj-bbox-width obj) 0))) ((p (in-list (obj-cells obj)))) (set-cell out (- (first p) (obj-r1 obj)) (- (second p) (obj-c1 obj)) (obj-color obj)))) (define (paste-crop grid shape top left) (for*/fold ((out grid)) ((r (in-range (rows shape))) (c (in-range (cols shape)))) (let ((v (at shape r c)) (rr (+ top r)) (cc (+ left c))) (if (and (not (= v 0)) (in-bounds? rr cc (rows grid) (cols grid))) (set-cell out rr cc v) out)))) (define (outline-cells r1 c1 r2 c2) (remove-duplicates (append (for/list ((c (in-range c1 (+ c2 1)))) (list r1 c)) (for/list ((c (in-range c1 (+ c2 1)))) (list r2 c)) (for/list ((r (in-range r1 (+ r2 1)))) (list r c1)) (for/list ((r (in-range r1 (+ r2 1)))) (list r c2))))) (define (rect-frame? obj) (let* ((r1 (obj-r1 obj)) (c1 (obj-c1 obj)) (r2 (obj-r2 obj)) (c2 (obj-c2 obj)) (cells (obj-cells obj)) (expected (outline-cells r1 c1 r2 c2))) (and (>= (- r2 r1) 2) (>= (- c2 c1) 2) (= (length cells) (length expected)) (all? (lambda (p) (member? p cells)) expected)))) (define (center-in-frame shape frame) (let* ((ih (- (obj-r2 frame) (obj-r1 frame) 1)) (iw (- (obj-c2 frame) (obj-c1 frame) 1)) (top (+ (obj-r1 frame) 1 (quotient (- ih (rows shape)) 2))) (left (+ (obj-c1 frame) 1 (quotient (- iw (cols shape)) 2)))) (list top left))) (let* ((comps (objects g 0)) (frames (sort (filter rect-frame? comps) (lambda (a b) (let ((aa (* (- (obj-r2 a) (obj-r1 a) 1) (- (obj-c2 a) (obj-c1 a) 1))) (bb (* (- (obj-r2 b) (obj-r1 b) 1) (- (obj-c2 b) (obj-c1 b) 1)))) (if (= aa bb) (< (obj-c1 a) (obj-c1 b)) (< aa bb)))))) (objs (sort (filter (lambda (obj) (not (rect-frame? obj))) comps) (lambda (a b) (if (= (obj-size a) (obj-size b)) (< (obj-c1 a) (obj-c1 b)) (< (obj-size a) (obj-size b))))))) (for/fold ((out (for/fold ((acc (empty-grid (rows g) (cols g) 0))) ((fr (in-list frames))) (paint-cells acc (obj-cells fr) (obj-color fr))))) ((obj (in-list objs)) (fr (in-list frames))) (let ((pos (center-in-frame (component-grid obj) fr))) (paste-crop out (component-grid obj) (first pos) (second pos)))))))

Provenance

Generator
generators/504e304a77f1/generator.py
Notes and decisions
generators/504e304a77f1/notes.md
Review label
reviewed_safe
Generator SHA-256
59e9cb73c92dd439a0073d7447b4dc5df143be392f04ec00d2e98785538c3b9b
Rule hash
6c92d838a5dd
Sources
bank:fc0f4ba66a95
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 504e304a77f1 --count 1 --seed 20261108 --test 1