← 6be2608558c4 · 6c08e545720f →

6be78d0010df

Two color-1 divider columns make three equal square panels. Crop the colored objects in A and B, infer their consistent one-to-one color map, then recolor the cropped C object with that map. A and B may be placed at different offsets, and the palette mapping need not preserve order.

analogycolor mappingpanel reasoning

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 (split-panels grid)
      (let ((seps (filter (lambda (c) (all? (lambda (r) (= (at grid r c) 1)) (range 0 (rows grid))))
                          (range 0 (cols grid)))))
        (let loop ([remaining (append seps (list (cols grid)))] [start 0] [panels (list)])
          (if (empty? remaining)
              (reverse panels)
              (let ((stop (first remaining)))
                (loop (rest remaining)
                      (+ stop 1)
                      (if (> stop start)
                          (cons (subgrid grid 0 start (- (rows grid) 1) (- stop 1)) panels)
                          panels)))))))
    (define (without-divider panel)
      (grid-from-fn (rows panel) (cols panel)
        (lambda (r c) (if (= (at panel r c) 1) 0 (at panel r c)))))
    (define (color-map-from a b)
      (if (or (not (= (rows a) (rows b))) (not (= (cols a) (cols b))))
          #f
          (let loop ([cells (grid-positions a)] [mapping (list)])
            (if (empty? cells)
                mapping
                (let* ((p (first cells))
                       (va (at a (first p) (second p)))
                       (vb (at b (first p) (second p)))
                       (entry (find-first (lambda (item) (= (first item) va)) mapping)))
                  (cond [(and (= va 0) (= vb 0)) (loop (rest cells) mapping)]
                        [(or (= va 0) (= vb 0)) #f]
                        [(and entry (not (= (second entry) vb))) #f]
                        [(not (eq? entry #f)) (loop (rest cells) mapping)]
                        [else (loop (rest cells) (cons (list va vb) mapping))]))))))
    (define (apply-cmap grid cmap)
      (grid-from-fn (rows grid) (cols grid)
        (lambda (r c)
          (let ((v (at grid r c)))
            (let ((entry (find-first (lambda (item) (= (first item) v)) cmap)))
              (if (or (= v 0) (not entry)) 0 (second entry)))))))
    (let* ((panels (split-panels g))
           (a (crop-to-content (without-divider (first panels))))
           (b (crop-to-content (without-divider (second panels))))
           (q (crop-to-content (without-divider (third panels))))
           (cmap (color-map-from a b)))
      (if (eq? cmap #f) q (apply-cmap q cmap)))))

Provenance

Generator
generators/6be78d0010df/generator.py
Notes and decisions
generators/6be78d0010df/notes.md
Review label
reviewed_safe
Generator SHA-256
28ea8292ac8ebfcf7b31796d45e139ec0f326aa9f1b36dce6e65d6a8a3c3f6e5
Rule hash
20d652a9b458
Sources
bank:6905604d1760
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 6be78d0010df --count 1 --seed 20261108 --test 1