← 4f065093e631 · 4f1ec6a61342 →

4f09f8bfa35a

Read row-0 rotation commands, select the largest body component with top/left tie breaks, crop the original body through its bounding box, rotate that crop for each command, and pack the copies with one-column gaps.

command legendrotation sequencetemplate reuse

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 ((cmds (filter (lambda (v) (member v (list 2 3 4 5))) (row g 0))))
    (define (apply-cmd grid code)
      (cond [(= code 2) grid]
            [(= code 3) (rotate-cw grid)]
            [(= code 4) (rotate-180 grid)]
            [else (rotate-ccw grid)]))
    (let* ((body (for/fold ([out g]) ([c (in-range (cols g))]) (set-cell out 0 c 0)))
           (mask (grid-from-fn (rows body) (cols body)
                   (lambda (r c) (if (= (at body r c) 0) 0 1))))
           (objs (sort (objects mask 0)
                       (lambda (a b)
                         (cond [(not (= (obj-size a) (obj-size b))) (> (obj-size a) (obj-size b))]
                               [(not (= (obj-r1 a) (obj-r1 b))) (< (obj-r1 a) (obj-r1 b))]
                               [else (< (obj-c1 a) (obj-c1 b))]))))
           (obj (first objs))
           (template (subgrid body (obj-r1 obj) (obj-c1 obj) (obj-r2 obj) (obj-c2 obj)))
           (copies (map (lambda (cmd) (apply-cmd template cmd)) cmds))
           (out-h (apply max (map rows copies)))
           (out-w (+ (apply + (map cols copies)) (max 0 (- (length copies) 1)))))
      (let pack ([remaining copies] [left 0] [out (empty-grid out-h out-w 0)])
        (if (empty? remaining)
            out
            (let* ((p (first remaining))
                   (next (for*/fold ([acc out])
                                     ([r (in-range (rows p))]
                                      [c (in-range (cols p))])
                           (let ((v (at p r c)))
                             (if (not (= v 0)) (set-cell acc r (+ left c) v) acc)))))
              (pack (rest remaining) (+ left (cols p) 1) next)))))))

Provenance

Generator
generators/4f09f8bfa35a/generator.py
Notes and decisions
generators/4f09f8bfa35a/notes.md
Review label
reviewed_safe
Generator SHA-256
fbe9445ba720e1b8bc13af7ac2f373ce6b9ab13887438e62f60357aada477764
Rule hash
8710221699c5
Sources
bank:8ed83d4e427b
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 4f09f8bfa35a --count 1 --seed 20261108 --test 1