← public_eval_53fb4810 · public_eval_581f7754 →
public_eval_5545f144
Extract the cursor motif, follow nearest aligned waypoints, rotate it to the final leg and render the clean final panel.
parametric family
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!
(lambda (g)
(let ()
(define bg (mode g -1))
(define sep (filter (lambda (c) (and (!= (at g 0 c) bg) (all? (lambda (r) (= (at g r c) (at g 0 c))) (range 0 (rows g))))) (range 0 (cols g))))
(define start (if (empty? sep) 0 (+ 1 (apply max sep))))
(define panel (subgrid g 0 start (- (rows g) 1) (- (cols g) 1)))
(define first-panel (subgrid g 0 0 (- (rows g) 1) (if (empty? sep) (- (cols g) 1) (- (apply min sep) 1))))
(define obs (objects-8 first-panel bg))
(define cursor (first (filter (lambda (o) (> (obj-size o) 1)) obs)))
(define template (obj-cells cursor))
(define (dot p d) (+ (* (first p) (first d)) (* (second p) (second d))))
(define dirs (list (list -1 0) (list 0 1) (list 1 0) (list 0 -1)))
(define (tip-for d)
(let* ((extent (apply max (map (lambda (p) (dot p d)) template)))
(end (filter (lambda (p) (= (dot p d) extent)) template)))
(if (= (length end) 1) (first end) #f)))
(define initial-heading
(first (filter
(lambda (d)
(let* ((tip (tip-for d)) (perp (list (second d) (- (first d))))
(back (apply min (map (lambda (p) (dot p d)) template))))
(and tip (> (count-if (lambda (p) (= (dot p d) back)) template) 1)
(all? (lambda (p)
(let ((off (- (dot p perp) (dot tip perp))))
(member (list (- (first p) (* 2 off (first perp)))
(- (second p) (* 2 off (second perp)))) template))) template)))) dirs)))
(define initial-tip (tip-for initial-heading))
(define (cw p) (list (second p) (- (first p))))
(define (spin p n) (if (= n 0) p (spin (cw p) (- n 1))))
(define ink (map (lambda (p) (list (first p) (second p))) (filter (lambda (p) (!= (third p) bg)) (grid-cells panel))))
(define matches
(apply append (map (lambda (n)
(filter (lambda (candidate) (all? (lambda (p) (member p ink)) (third candidate)))
(map (lambda (anchor)
(list anchor (spin initial-heading n)
(map (lambda (p)
(let ((v (spin (list (- (first p) (first initial-tip)) (- (second p) (second initial-tip))) n)))
(list (+ (first anchor) (first v)) (+ (second anchor) (second v))))) template))) ink))) (range 0 4))))
(define found (first matches))
(define tip (first found))
(define heading (second found))
(define cells (third found))
(define dots (filter (lambda (p) (not (member p cells))) ink))
(define (distance p q) (+ (abs (- (first p) (first q))) (abs (- (second p) (second q)))))
(define trace
(let loop ((pos tip) (todo dots) (direction heading))
(if (empty? todo) (list pos direction)
(let* ((aligned (filter (lambda (p) (or (= (first p) (first pos)) (= (second p) (second pos)))) todo))
(next (first (sort aligned (lambda (a b) (< (distance a pos) (distance b pos))))))
(dr (- (first next) (first pos))) (dc (- (second next) (second pos)))
(length (+ (abs dr) (abs dc))))
(loop next (filter (lambda (p) (not (equal? p next))) todo) (list (/ dr length) (/ dc length)))))))
(define target (first trace))
(define final-heading (second trace))
(define (rotate p)
(let turn ((v p) (d heading))
(if (equal? d final-heading) v (turn (cw v) (cw d)))))
(define moved
(map (lambda (p)
(let ((v (rotate (list (- (first p) (first tip)) (- (second p) (second tip))))))
(list (+ (first target) (first v)) (+ (second target) (second v))))) cells))
(paint-cells (empty-grid (rows panel) (cols panel) bg) moved (obj-color cursor)))))
Provenance
- Generator
- generators/public_eval_5545f144/generator.py
- Notes and decisions
- generators/public_eval_5545f144/notes.md
- Review label
- reviewed_safe
- Generator SHA-256
- 9f040e6f35cf663316c5319129e1a429c82a885ae194f3684206a884339eed2b
- Rule hash
- 4645e897ca03
- Sources
- evaluation, public_eval:5545f144
- Lesson seeds
- 20261108, 20261109, 20261110, 20261111, 20261112
- Reproduce lesson 1
arcpuzzles generate public_eval_5545f144 --count 1 --seed 20261108 --test 1