← a8a99930c51a · a90d16507995 →

a8d6e6039a6f

Find the free multicolor template and every hollow gray frame. Read the single nearby key for each frame, transform the template by 1=identity, 2=rotate clockwise, 3=flip left/right, or 4=flip up/down, and center the transformed stamp inside that frame. Remove the source template and keys.

framesmulti_targettransform

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 ()
    (define (frame? obj)
      (and (= (obj-color obj) 5) (hollow-frame? obj)))
    (define (frame< a b)
      (cell< (list (obj-r1 a) (obj-c1 a))
             (list (obj-r1 b) (obj-c1 b))))
    (define (key-of frame)
      (let* ((top (obj-r1 frame))
             (bottom (obj-r2 frame))
             (left (obj-c1 frame))
             (right (obj-c2 frame))
             (positions
              (list (list (- top 1) left) (list (- top 1) right)
                    (list (+ bottom 1) left) (list (+ bottom 1) right)
                    (list top (- left 1)) (list top (+ right 1))
                    (list bottom (- left 1)) (list bottom (+ right 1))))
             (values
              (filter (lambda (value) (and (>= value 1) (<= value 4)))
                      (map (lambda (position)
                             (if (in-bounds? (first position) (second position)
                                             (rows g) (cols g))
                                 (at g (first position) (second position))
                                 0))
                           positions))))
        (if (empty? values) 1 (first (sort values <)))))
    (define (transform piece key)
      (cond ((= key 2) (rotate-cw piece))
            ((= key 3) (flip-lr piece))
            ((= key 4) (flip-ud piece))
            (else piece)))
    (define (stamp out frame template)
      (let* ((piece (transform template (key-of frame)))
             (interior-h (- (obj-h frame) 2))
             (interior-w (- (obj-w frame) 2))
             (top (+ (obj-r1 frame) 1
                     (max 0 (quotient (- interior-h (rows piece)) 2))))
             (left (+ (obj-c1 frame) 1
                      (max 0 (quotient (- interior-w (cols piece)) 2)))))
        (paste-crop out piece top left)))
    (let* ((frames (sort (filter frame? (objects g 0)) frame<))
           (template-cells
            (filter (lambda (position)
                      (> (at g (first position) (second position)) 5))
                    (grid-positions g))))
      (if (empty? template-cells)
          g
          (let* ((template (crop-cells g template-cells))
                 (base
                  (for/fold ((out (empty-grid (rows g) (cols g) 0)))
                            ((frame (in-list frames)))
                    (paint-cells out (obj-cells frame) 5))))
            (for/fold ((out base)) ((frame (in-list frames)))
              (stamp out frame template)))))))

Provenance

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