← cfd0943c5b14 · d02691ffb818 →

d01b33f4a589

Read the four corner cells as transform commands, crop the non-corner motif, transform it once per corner in reading order, and pack the four variants into a 2-by-2 output.

parametric familymulti-command transformstiling assembly

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).

Reference rule (Racket)

(rule!
  (let ((dummy 0))
    (define (transform-code grid code)
      (cond [(= code 1) (rotate-cw grid)]
            [(= code 2) (rotate-180 grid)]
            [(= code 3) (flip-lr grid)]
            [else (flip-ud grid)]))
    (define (crop-cells base cells)
      (let* ((bb (bbox-of-cells cells))
             (r0 (first bb)) (c0 (second bb))
             (r1 (third bb)) (c1 (fourth bb)))
        (grid-from-fn (+ 1 (- r1 r0)) (+ 1 (- c1 c0))
          (lambda (r c)
            (let ((rr (+ r0 r)) (cc (+ c0 c)))
              (if (member? (list rr cc) cells) (at base rr cc) 0))))))
    (define (paste-nonzero out pat top left)
      (for*/fold ([acc out])
                 ([r (in-range (rows pat))]
                  [c (in-range (cols pat))]
                  #:when (not (= (at pat r c) 0)))
        (set-cell acc (+ top r) (+ left c) (at pat r c))))
    (let* ((h (rows g))
           (w (cols g))
           (codes (list (at g 0 0) (at g 0 (- w 1)) (at g (- h 1) 0) (at g (- h 1) (- w 1))))
           (ignore (list (list 0 0) (list 0 (- w 1)) (list (- h 1) 0) (list (- h 1) (- w 1))))
           (motif-cells
             (filter-cells g
               (lambda (r c v) (and (not (= v 0)) (not (member? (list r c) ignore))))))
           (motif (crop-cells g motif-cells))
           (variants (map (lambda (code) (transform-code motif code)) codes))
           (cell-h (apply max (map rows variants)))
           (cell-w (apply max (map cols variants))))
      (for/fold ([out (empty-grid (* 2 cell-h) (* 2 cell-w) 0)])
                ([variant (in-list variants)] [idx (in-naturals)])
        (paste-nonzero out variant (* (quotient idx 2) cell-h) (* (modulo idx 2) cell-w))))))

Provenance

Generator
generators/d01b33f4a589/generator.py
Notes and decisions
generators/d01b33f4a589/notes.md
Review label
reviewed_safe
Generator SHA-256
52b10583ab11154a71c7178c961bd98beeeae8c57ca8893c868476af09a17d66
Rule hash
0bc6b5986853
Sources
bank:26462ff56908
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate d01b33f4a589 --count 1 --seed 20261108 --test 1