← f38ce802fe57 · f44596002946 →

f41ae450c30b

A zero-background grid contains three or four separated, distinctly colored domino components. Three components form a horizontal or vertical A-B-C line: adjacent pairs have clear line of sight, while the middle component blocks the two outer components. Sort components by centroid column then centroid row and emit an N×N matrix whose diagonal is the component colors and whose off-diagonal entries are 8 exactly for unobstructed row/column visibility, otherwise 0.

adjacency_matrixvisibility_graph

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 objs (objects g 0))
    (define (cell-in? p obj) (member p (obj-cells obj)))
    (define (clear-row? r c1 c2 a b)
      (all? (lambda (c)
              (let ((p (list r c)))
                (or (cell-in? p a) (cell-in? p b) (= (at g r c) 0))))
            (range (min c1 c2) (+ (max c1 c2) 1))))
    (define (clear-col? c r1 r2 a b)
      (all? (lambda (r)
              (let ((p (list r c)))
                (or (cell-in? p a) (cell-in? p b) (= (at g r c) 0))))
            (range (min r1 r2) (+ (max r1 r2) 1))))
    (define (visible? a b)
      (any? (lambda (pa)
              (any? (lambda (pb)
                      (or (and (= (first pa) (first pb))
                               (clear-row? (first pa) (second pa) (second pb) a b))
                          (and (= (second pa) (second pb))
                               (clear-col? (second pa) (first pa) (first pb) a b))))
                    (obj-cells b)))
            (obj-cells a)))
    (define (sum-cols obj) (apply + (map second (obj-cells obj))))
    (define (sum-rows obj) (apply + (map first (obj-cells obj))))
    (define (before? a b)
      (let ((lhs (* (sum-cols a) (obj-size b)))
            (rhs (* (sum-cols b) (obj-size a))))
        (if (= lhs rhs)
            (< (* (sum-rows a) (obj-size b)) (* (sum-rows b) (obj-size a)))
            (< lhs rhs))))
    (define ordered
      (sort objs before?))
    (define n (length ordered))
    (grid-from-fn n n
      (lambda (r c)
        (let ((a (list-ref ordered r)) (b (list-ref ordered c)))
          (if (= r c)
              (obj-color a)
              (if (visible? a b) 8 0)))))))

Provenance

Generator
generators/f41ae450c30b/generator.py
Notes and decisions
generators/f41ae450c30b/notes.md
Review label
reviewed_safe
Generator SHA-256
1302b515ef29e923bfb242e9d56a826c0fd2bdfd4fabb22c6288a0205a19d0c2
Rule hash
8601bafc35ff
Sources
bank:f4425e302da7
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate f41ae450c30b --count 1 --seed 20261108 --test 1