← 058ae70e4bdb · 05d60f5e74c6 →

05b5a82ace36

Largest {2,4}-colored blob is the template; every cell colored 6-9 is an anchor. Output is a BLANK grid with the normalized template stamped at each anchor cell (bbox top-left on the anchor) in the anchor's color; out-of-bounds stamp cells clip. (Was: 5 fixed 3-4 cell templates always in the top-left corner, largest-blob selection never contested, no clipping, and two degenerates that CRASH the rule.)

parametric familyanchor recoloringbroadcast copycomponent normalization

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 (components-allowed allowed)
      (define visited (make-hash))
      (define comps (list))
      (for* ([r (in-range (rows g))] [c (in-range (cols g))])
        (when (and (member (at g r c) allowed)
                   (not (hash-has-key? visited (cons r c))))
          (define queue (list (list r c)))
          (define cells (list))
          (hash-set! visited (cons r c) #t)
          (define (bfs)
            (unless (empty? queue)
              (define p (first queue))
              (set! queue (rest queue))
              (set! cells (cons p cells))
              (for ([d (in-list cardinal-deltas)])
                (define nr (+ (first p) (first d)))
                (define nc (+ (second p) (second d)))
                (when (and (in-bounds? nr nc (rows g) (cols g))
                           (member (at g nr nc) allowed)
                           (not (hash-has-key? visited (cons nr nc))))
                  (hash-set! visited (cons nr nc) #t)
                  (set! queue (append queue (list (list nr nc))))))
              (bfs)))
          (bfs)
          (set! comps (cons (reverse cells) comps))))
      (reverse comps))
    (define (normalize cells)
      (let ((bb (bbox-of-cells cells)))
        (map (lambda (p) (list (- (first p) (first bb)) (- (second p) (second bb)))) cells)))
    (let* ((source (first (sort (filter (lambda (cells) (> (length cells) 1))
                                        (components-allowed (list 2 4)))
                                (lambda (a b) (> (length a) (length b))))))
           (norm (normalize source))
           (anchors (filter (lambda (cell) (member (third cell) (list 6 7 8 9))) (grid-cells g))))
      (for/fold ([out (empty-grid (rows g) (cols g) 0)]) ([anchor (in-list anchors)])
        (paint-cells out
          (map (lambda (p) (list (+ (first anchor) (first p))
                                 (+ (second anchor) (second p))
                                 (third anchor)))
               norm))))))

Provenance

Generator
generators/05b5a82ace36/generator.py
Notes and decisions
generators/05b5a82ace36/notes.md
Review label
reviewed_safe
Generator SHA-256
5212060d6a59ff8ef42ff4bd3f97f6440e2c203dbf70cf18292d7955ffbc5e36
Rule hash
4d48e070faa6
Sources
bank:3c7b85b8eeb1
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 05b5a82ace36 --count 1 --seed 20261108 --test 1