← f2e717c7c250 · f361853c0fcd →

f34cf63540e2

Apply row-zero transform commands left-to-right to the first lower nonzero component's rectangular crop.

command compositioncrop outputmultiple 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).

Reference rule (Racket)

(rule!
  (let ((dummy 0))
    (define (apply-transform grid cmd)
      (cond [(= cmd 0) grid]
            [(= cmd 1) (rotate-cw grid)]
            [(= cmd 2) (rotate-180 grid)]
            [(= cmd 3) (transpose grid)]
            [(= cmd 4) (flip-lr grid)]
            [else (flip-ud grid)]))
    (define (nonzero-components grid)
      (let loop ([remaining (filter-cells grid (lambda (r c v) (not (= v 0))))] [acc (list)])
        (if (empty? remaining)
            (reverse acc)
            (let* ((start (first remaining))
                   (cells (connected-region grid (first start) (second start)
                            (lambda (r c v) (not (= v 0))) 4)))
              (loop (filter (lambda (p) (not (member? p cells))) remaining)
                    (cons cells acc))))))
    (define (mapped-cmd cmd)
      (cond [(= cmd 2) 1] [(= cmd 3) 2] [(= cmd 4) 3] [(= cmd 5) 4] [else 5]))
    (let* ((cmds (filter (lambda (v) (not (= v 0))) (row g 0)))
           (components (filter (lambda (cells) (> (first (bbox-of-cells cells)) 0))
                               (nonzero-components g)))
           (chosen (first (sort components
                            (lambda (a b)
                              (let ((ba (bbox-of-cells a)) (bb (bbox-of-cells b)))
                                (if (= (first ba) (first bb))
                                    (< (second ba) (second bb))
                                    (< (first ba) (first bb))))))))
           (bb (bbox-of-cells chosen))
           (motif (subgrid g (first bb) (second bb) (third bb) (fourth bb))))
      (foldl (lambda (cmd acc) (apply-transform acc (mapped-cmd cmd))) motif cmds))))

Provenance

Generator
generators/f34cf63540e2/generator.py
Notes and decisions
generators/f34cf63540e2/notes.md
Review label
reviewed_safe
Generator SHA-256
fc7ae0daa2c96c775587a37aa4183c6b454251c2b7db96ee3b72f536eca0a4bd
Rule hash
1157bcb457e5
Sources
bank:868e1a8cbe17
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate f34cf63540e2 --count 1 --seed 20261108 --test 1