← e942ce41cbf5 · e971e0773705 →

e965836d9f92

Read transform codes from the top header and colors from the left header. Crop the single body prototype, then output every transformed × recolored copy in a gallery with one-cell separators.

control headerscross-product constructionpanel layoutshape transforms

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!
 ;; The top header row lists transform CODES and the left header column
 ;; lists COLORS; the body holds one prototype shape. Print the whole
 ;; gallery — a row per color, a column per code — each panel the
 ;; prototype transformed (1 id / 2 flip-lr / 3 flip-ud / 4 cw / 5 180
 ;; / 6 ccw) and recolored, with 1-cell gaps between panels.
 (lambda (g)
   (let ()
     (define codes
       (map (lambda (c) (at g 0 c))
            (filter (lambda (c) (> (at g 0 c) 0)) (range 1 w))))
     (define colors
       (map (lambda (r) (at g r 0))
            (filter (lambda (r) (> (at g r 0) 0)) (range 1 h))))
     (define body  ;; the grid with both header lines blanked
       (cellmap g (r c v)
                (if (or (and (zero? r) (> c 0)) (and (zero? c) (> r 0)))
                    0 v)))
     (define proto  ;; largest 4-connected nonzero blob, as a 0/1 mask
       (let ((cells (normalize-cells
                     (obj-cells
                      (pick-max (objects (cellmap body (r c v)
                                                  (if (zero? v) 0 1))
                                         0)
                                obj-size)))))
         (paint-cells (empty-grid (+ 1 (max-of first cells))
                                  (+ 1 (max-of second cells))
                                  0)
                      cells 1)))
     (define (xform grid code)
       (cond ((= code 2) (flip-lr grid))
             ((= code 3) (flip-ud grid))
             ((= code 4) (rotate-cw grid))
             ((= code 5) (rotate-180 grid))
             ((= code 6) (rotate-ccw grid))
             (else grid)))
     (define panels
       (map (lambda (color)
              (map (lambda (code)
                     (cellmap (xform proto code) (r c v)
                              (if (zero? v) 0 color)))
                   codes))
            colors))
     (let ((ph (rows (first (first panels))))
           (pw (cols (first (first panels))))
           (nr (length panels))
           (nc (length (first panels))))
       (for*/fold ((out (empty-grid (+ (* nr ph) (max 0 (- nr 1)))
                                    (+ (* nc pw) (max 0 (- nc 1)))
                                    0)))
                  ((ri (range 0 nr)) (ci (range 0 nc)))
         (let ((panel (nth (nth panels ri) ci)))
           (for*/fold ((acc out)) ((r (range 0 (rows panel)))
                                   (c (range 0 (cols panel))))
             (let ((v (at panel r c))
                   (rr (+ (* ri (+ ph 1)) r))
                   (cc (+ (* ci (+ pw 1)) c)))
               (if (and (> v 0) (in-bounds? rr cc (rows acc) (cols acc)))
                   (set-cell acc rr cc v)
                   acc)))))))))

Provenance

Generator
generators/e965836d9f92/generator.py
Notes and decisions
generators/e965836d9f92/notes.md
Review label
reviewed_safe
Generator SHA-256
b93666cd030874e8e91049d9de47be6d539c492d3e8bccad50b1e9c2847e6ae3
Rule hash
29642118732e
Sources
bank:01130745873d
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate e965836d9f92 --count 1 --seed 20261108 --test 1