← 5faf9d5e3e6d · 5ffd8d801705 →

5fdbbb5a53ef

0-background grids contain color-9 5x5 frames in top and left galleries. Each 3x3 interior contains one colored shape. The output is a left-by-top relation matrix: 8=same shape up to rotation and same color, 6=shape only, 3=color only, 0=neither. Gallery order, sizes, offsets, shapes, rotations, and colors vary; every generated input teaches 8, 6, and 3.

color comparisonrelation matricesrotation invarianceshape comparison

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!
 ;; Maroon(9) frames form a top header row and a left header column of
 ;; small colored shapes. Output the relation matrix (left headers x
 ;; top headers): cyan(8) = same shape (up to rotation) AND same color,
 ;; magenta(6) = shape only, green(3) = color only, 0 = neither.
 (lambda (g)
   (let ()
     (define (crop-nonzero grid)
       (let ((cells (filter (lambda (p) (> (at grid (first p) (second p)) 0))
                            (grid-positions grid))))
         (if (empty? cells)
             (list (list 0))
             (let ((bb (bbox-of-cells cells)))
               (subgrid grid (first bb) (second bb)
                        (third bb) (fourth bb))))))
     (define (shape-of grid)  ;; binary silhouette cropped to content
       (crop-nonzero (grid-from-fn (rows grid) (cols grid)
                                   (lambda (r c)
                                     (if (= (at grid r c) 0) 0 1)))))
     (define (same-shape? a b)  ;; equal silhouettes up to 90-degree turns
       (member? (shape-of b)
                (let loop ((cur (shape-of a)) (n 0) (acc (list)))
                  (if (= n 4) acc
                      (loop (rotate-cw cur) (+ n 1) (cons cur acc))))))
     (define (color-of grid)
       (first (filter (lambda (v) (> v 0)) (apply append grid))))
     (define (frame? o)  ;; hollow rectangle outline, at least 3x3
       (and (>= (obj-h o) 3) (>= (obj-w o) 3)
            (= (obj-size o) (- (* 2 (+ (obj-h o) (obj-w o))) 4))
            (all? (lambda (p) (or (= (first p) (obj-r1 o))
                                  (= (first p) (obj-r2 o))
                                  (= (second p) (obj-c1 o))
                                  (= (second p) (obj-c2 o))))
                  (obj-cells o))))
     (define (interior fr)
       (crop-nonzero (subgrid g (+ (obj-r1 fr) 1) (+ (obj-c1 fr) 1)
                              (- (obj-r2 fr) 1) (- (obj-c2 fr) 1))))
     (define frames
       (filter (lambda (o) (and (= (obj-color o) 9) (frame? o)))
               (objects g 0)))
     (define top (apply min (map obj-r1 frames)))
     (define tops
       (map interior (sort (filter (lambda (f) (= (obj-r1 f) top)) frames)
                           (lambda (a b) (< (obj-c1 a) (obj-c1 b))))))
     (define lefts
       (map interior
            (sort (filter (lambda (f)
                            (and (= (obj-c1 f)
                                    (apply min (map obj-c1 frames)))
                                 (> (obj-r1 f) top)))
                          frames)
                  (lambda (a b) (< (obj-r1 a) (obj-r1 b))))))
     (grid-from-fn (length lefts) (length tops)
                   (lambda (r c)
                     (let* ((a (list-ref lefts r))
                            (b (list-ref tops c))
                            (shape-hit (same-shape? a b))
                            (color-hit (= (color-of a) (color-of b))))
                       (cond ((and shape-hit color-hit) 8)
                             (shape-hit 6)
                             (color-hit 3)
                             (else 0))))))))

Provenance

Generator
generators/5fdbbb5a53ef/generator.py
Notes and decisions
generators/5fdbbb5a53ef/notes.md
Review label
reviewed_safe
Generator SHA-256
629d9f4e8580208d8f6d4f70a7ddaf2dcf5f648265e57d8cdd1d3b64946f87da
Rule hash
b12aeca2f818
Sources
bank:9f005a7005fe
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 5fdbbb5a53ef --count 1 --seed 20261108 --test 1