← 806425ca81b3 · 807c284a7e79 →

8069b5294ce4

Find monochrome 4-connected objects and their cardinal-contact graph. The unique blue (1) object selects one connected component; sort that component by top-left cell and emit its square adjacency matrix with 1 on the diagonal, 8 for touching object pairs, and 0 otherwise.

parametric familycluster extractioncomponent orderingconstructive graph output

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 (top-left obj) (first (sort (obj-cells obj) cell<))) (define (adjacent? grid a b) (any? (lambda (p) (any? (lambda (d) (member (list (+ (first p) (first d)) (+ (second p) (second d))) (obj-cells b))) cardinal-deltas)) (obj-cells a))) (define (neighbors grid objs i) (filter (lambda (j) (and (not (= i j)) (adjacent? grid (list-ref objs i) (list-ref objs j)))) (range 0 (length objs)))) (define (neighbors-in grid objs allowed i) (filter (lambda (j) (member j allowed)) (neighbors grid objs i))) (define (cluster-from grid objs start allowed) (let ((seen (make-hash))) (let bfs ((queue (list start)) (acc (list))) (if (empty? queue) (reverse acc) (let ((i (first queue))) (cond ((hash-has-key? seen i) (bfs (rest queue) acc)) ((not (member i allowed)) (bfs (rest queue) acc)) (else (hash-set! seen i #t) (bfs (append (rest queue) (neighbors-in grid objs allowed i)) (cons i acc))))))))) (define (sorted-ids-top-left objs ids) (sort ids (lambda (a b) (cell< (top-left (list-ref objs a)) (top-left (list-ref objs b)))))) (define objs (objects g 0)) (define seed (first (filter (lambda (i) (= (obj-color (list-ref objs i)) 1)) (range 0 (length objs))))) (define cl (cluster-from g objs seed (range 0 (length objs)))) (define ids (sorted-ids-top-left objs cl)) (define n (length ids)) (grid-from-fn n n (lambda (r c) (let ((cid (list-ref ids r)) (nid (list-ref ids c))) (cond ((= r c) 1) ((member nid (neighbors g objs cid)) 8) (else 0)))))))

Provenance

Generator
generators/8069b5294ce4/generator.py
Notes and decisions
generators/8069b5294ce4/notes.md
Review label
reviewed_safe
Generator SHA-256
7856004820a355f768cb69f58fc4cdf42fd0c0a63acdc118ca03b06fd30273c4
Rule hash
9b665edfdc5f
Sources
bank:3a1815be7c2e
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 8069b5294ce4 --count 1 --seed 20261108 --test 1