← c2cd365ed4fa · c2fb0e01a539 →

c2f4b540f2fb

A zero-background grid contains a source local frame marked by colors 2 (origin), 3 (+u), and 4 (+v), and a target frame marked analogously by 5, 6, and 7. Three or four cyan (8) source points lie within local radius 3. The output preserves the input and stamps into the target frame every cyan point whose source-local u coordinate is maximal. Coordinates are transferred frame-relatively, and every tie on the maximum-u tier is copied.

parametric familylocal ranking, selection, frame-relative copy

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 (point< a b) (cond ((not (= (first a) (first b))) (< (first a) (first b))) ((not (= (second a) (second b))) (< (second a) (second b))) (else (< (third a) (third b))))) (define (make-frame origin vx vy colors) (list origin vx vy colors)) (define (frame-origin f) (first f)) (define (frame-vx f) (second f)) (define (frame-vy f) (third f)) (define (frame< a b) (let ((oa (frame-origin a)) (ob (frame-origin b)) (vxa (frame-vx a)) (vxb (frame-vx b)) (vya (frame-vy a)) (vyb (frame-vy b))) (cond ((not (= (first oa) (first ob))) (< (first oa) (first ob))) ((not (= (second oa) (second ob))) (< (second oa) (second ob))) ((not (= (first vxa) (first vxb))) (< (first vxa) (first vxb))) ((not (= (second vxa) (second vxb))) (< (second vxa) (second vxb))) ((not (= (first vya) (first vyb))) (< (first vya) (first vyb))) (else (< (second vya) (second vyb)))))) (define (gpos frame u v) (let* ((origin (frame-origin frame)) (vx (frame-vx frame)) (vy (frame-vy frame))) (list (+ (first origin) (* u (first vx)) (* v (first vy))) (+ (second origin) (* u (second vx)) (* v (second vy)))))) (define (lpos frame p) (let* ((origin (frame-origin frame)) (dr (- (first p) (first origin))) (dc (- (second p) (second origin))) (vx (frame-vx frame)) (vy (frame-vy frame))) (list (+ (* dr (first vx)) (* dc (second vx))) (+ (* dr (first vy)) (* dc (second vy)))))) (define (find-frames grid colors) (let* ((a (first colors)) (b (second colors)) (c (third colors)) (raw (filter values (for*/list ((r (in-range (rows grid))) (col (in-range (cols grid))) (dx (in-list cardinal-deltas)) (dy (in-list cardinal-deltas))) (let* ((xr (+ r (first dx))) (xc (+ col (second dx))) (yr (+ r (first dy))) (yc (+ col (second dy)))) (if (and (= (at grid r col) a) (in-bounds? xr xc (rows grid) (cols grid)) (in-bounds? yr yc (rows grid) (cols grid)) (= (at grid xr xc) b) (= (at grid yr yc) c) (= (+ (* (first dx) (first dy)) (* (second dx) (second dy))) 0)) (make-frame (list r col) dx dy colors) #f)))))) (sort (remove-duplicates raw) frame<))) (define (extract-local-points grid frame colors radius) (let ((rad (min radius 3))) (sort (filter values (for*/list ((r (in-range (rows grid))) (c (in-range (cols grid)))) (let ((v (at grid r c))) (if (member? v colors) (let ((uv (lpos frame (list r c)))) (if (<= (max (abs (first uv)) (abs (second uv))) rad) (list (first uv) (second uv) v) #f)) #f)))) point<))) (define (point-color p) (third p)) (define (paint-local-points grid frame points) (for/fold ((out grid)) ((p (in-list points))) (let ((rc (gpos frame (first p) (second p)))) (set-cell out (first rc) (second rc) (point-color p))))) (let* ((sf (first (find-frames g (list 2 3 4)))) (tf (first (find-frames g (list 5 6 7)))) (pts (extract-local-points g sf (list 8) 4)) (maxu (apply max (map first pts))) (chosen (filter (lambda (p) (= (first p) maxu)) pts))) (paint-local-points g tf chosen))))

Provenance

Generator
generators/c2f4b540f2fb/generator.py
Notes and decisions
generators/c2f4b540f2fb/notes.md
Review label
reviewed_safe
Generator SHA-256
19396509ae13055d49dff594a29c234f2b22a80ec1cc0ce330b3cb3bdc53013f
Rule hash
2d3609bffb9d
Sources
bank:f05110b6a734
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate c2f4b540f2fb --count 1 --seed 20261108 --test 1