← 5a40ab695e6e · 5a6a772cd217 →

5a44a210e9ea

Read every nonzero colour in row 0 from left to right as the palette. In rows 1 onward, find 4-connected blue (1) components that are exact rectangular borders, sort those valid frames largest first, and recolour them by depth. Reuse the last palette colour for deeper frames. Erase all malformed blue components and drop the palette row.

frame detectionnesting depthpalette mapping

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 palette (filter (lambda (v) (not (= v 0))) (first g)))
    (define body (subgrid g 1 0 (- (rows g) 1) (- (cols g) 1)))
    (define (rect-frame? obj)
      (and (= (obj-color obj) 1)
           (>= (obj-h obj) 3)
           (>= (obj-w obj) 3)
           (= (obj-size obj) (- (* (obj-h obj) (obj-w obj))
                                (* (- (obj-h obj) 2) (- (obj-w obj) 2))))
           (all? (lambda (p)
                   (or (= (first p) (obj-r1 obj))
                       (= (first p) (obj-r2 obj))
                       (= (second p) (obj-c1 obj))
                       (= (second p) (obj-c2 obj))))
                 (obj-cells obj))))
    (define frames
      (sort (filter rect-frame? (objects body 0))
            (lambda (a b)
              (> (* (obj-h a) (obj-w a)) (* (obj-h b) (obj-w b))))))
    (define (frame-cells obj)
      (append
        (for/list ([c (in-range (obj-c1 obj) (+ (obj-c2 obj) 1))]) (list (obj-r1 obj) c))
        (for/list ([c (in-range (obj-c1 obj) (+ (obj-c2 obj) 1))]) (list (obj-r2 obj) c))
        (for/list ([r (in-range (obj-r1 obj) (+ (obj-r2 obj) 1))]) (list r (obj-c1 obj)))
        (for/list ([r (in-range (obj-r1 obj) (+ (obj-r2 obj) 1))]) (list r (obj-c2 obj)))))
    (for/fold ([out (empty-grid (rows body) (cols body) 0)])
              ([frame (in-list frames)] [idx (in-naturals)])
      (paint-cells out (frame-cells frame)
                   (if (< idx (length palette)) (list-ref palette idx) (last palette))))))

Provenance

Generator
generators/5a44a210e9ea/generator.py
Notes and decisions
generators/5a44a210e9ea/notes.md
Review label
reviewed_safe
Generator SHA-256
6744032ebca440f0d65a74ad8965608b278dd463b6f07166cfc0e9de83adfa7f
Rule hash
8d815468fa81
Sources
bank:edd0efb19ea0
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 5a44a210e9ea --count 1 --seed 20261108 --test 1