← 8c7daa3d3cef · 8ce1331089a3 →

8c82d72dafe9

On a zero-background grid, every nonzero color appearing exactly twice in different rows and columns marks opposite corners of a rectangle. Paint that rectangle's complete border in the same color while preserving all other input cells. Exactly-two collinear colors and colors with other multiplicities are distractors. Intersecting borders are processed in row-major first-occurrence color order, so the later qualifying color wins.

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!
  (let ((dummy 0))
    (define (has-color? color colors)
      (any? (lambda (c) (= c color)) colors))
    (define (color-order cells acc)
      (if (empty? cells)
          (reverse acc)
          (let ((v (third (first cells))))
            (if (or (= v 0) (has-color? v acc))
                (color-order (cdr cells) acc)
                (color-order (cdr cells) (cons v acc))))))
    (define colors (color-order (grid-cells g) (list)))
    (define (rect-for color)
      (let ((cells (find-color g color)))
        (if (= (length cells) 2)
            (let* ((a (first cells))
                   (b (second cells))
                   (r0 (min (fst a) (fst b)))
                   (r1 (max (fst a) (fst b)))
                   (c0 (min (snd a) (snd b)))
                   (c1 (max (snd a) (snd b))))
              (if (and (not (= r0 r1)) (not (= c0 c1)))
                  (list color r0 c0 r1 c1)
                  #f))
            #f)))
    (define rects (filter (lambda (x) x) (map rect-for colors)))
    (define (on-border? r c rect)
      (let ((r0 (second rect)) (c0 (third rect)) (r1 (fourth rect)) (c1 (nth rect 4)))
        (and (>= r r0) (<= r r1) (>= c c0) (<= c c1)
             (or (= r r0) (= r r1) (= c c0) (= c c1)))))
    (define (border-color r c)
      (foldl
        (lambda (rect acc)
          (if (on-border? r c rect) (first rect) acc))
        #f
        rects))
    (grid-from-fn h w
      (lambda (r c)
        (let ((bc (border-color r c)))
          (if bc bc (cell-at g r c)))))))

Provenance

Generator
generators/8c82d72dafe9/generator.py
Notes and decisions
generators/8c82d72dafe9/notes.md
Review label
reviewed_safe
Generator SHA-256
e86affc7e7a2b99467365d1c40708a330e3dc8f10dc51261d479bc9a00b14aa0
Rule hash
70532d39072c
Sources
bank:f6c2fd26c5e5
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 8c82d72dafe9 --count 1 --seed 20261108 --test 1