← public_eval_a32d8b75 · public_eval_a47bf94d →

public_eval_a395ee82

Decode a sparse map and scale motif stamps

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!
 ;; Decode the isolated symbol map around its template-colored anchor.
 ;; Map spacing encodes tile offsets, not physical stamp spacing: each
 ;; target displacement is multiplied by the template bounding-box size.
 ;; Erase the map, recolor the central template to the symbol color, and
 ;; stamp the template ink at each remote target in the original ink color.
 (lambda (g)
  (let ()
   (define holes? #f)
   (define bg (mode g -1))
   (define obs (objects g bg))
   (define shape (pick-max obs obj-size))
   (if (or (not shape) (<= (obj-size shape) 1)) g
    (let ()
     (define ink (obj-color shape))
     (define tokens (filter (lambda (o) (= (obj-size o) 1)) obs))
     (define anchors (filter (lambda (o) (= (obj-color o) ink)) tokens))
     (define marks (filter (lambda (o) (not (= (obj-color o) ink))) tokens))
     (if (or (not (= (length anchors) 1)) (null? marks)) g
      (let ()
       (define anchor (first anchors))
       (define tint (obj-color (first marks)))
       (define (gcd2 a b) (if (= b 0) a (gcd2 b (modulo a b))))
       (define (pitch coord)
        (define nums (sort (remove-duplicates (map coord tokens)) <))
        (if (< (length nums) 2) 1
         (for/fold ((v 0)) ((x (rest nums))) (gcd2 v (- x (first nums))))))
       (define pr (pitch obj-r1))
       (define pc (pitch obj-c1))
       (define sh (obj-h shape))
       (define sw (obj-w shape))
       (define rr (obj-r1 shape))
       (define cc (obj-c1 shape))
       (define cellmask
        (for*/list ((r (range sh)) (c (range sw))
          #:when (if holes? (= (at g (+ rr r) (+ cc c)) bg)
                             (= (at g (+ rr r) (+ cc c)) ink))) (list r c)))
       (define center (recolor-cells (empty-grid (rows g) (cols g) bg)
                                     (obj-cells shape) tint))
       (for/fold ((out center)) ((mark marks))
        (define tr (+ rr (* sh (/ (- (obj-r1 mark) (obj-r1 anchor)) pr))))
        (define tc (+ cc (* sw (/ (- (obj-c1 mark) (obj-c1 anchor)) pc))))
        (paint-cells out (map (lambda (p) (list (+ tr (first p)) (+ tc (second p)))) cellmask) ink)))))))))

Provenance

Generator
generators/public_eval_a395ee82/generator.py
Notes and decisions
generators/public_eval_a395ee82/notes.md
Review label
reviewed_safe
Generator SHA-256
25b0ea15d204175ce0a28fcbda1489df21d19439f6449e94eed9159214842647
Rule hash
86780fc88348
Sources
evaluation, public_eval:a395ee82
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate public_eval_a395ee82 --count 1 --seed 20261108 --test 1