← 75c10ce4046c · 761a24339019 →

75ff4423494a

A two-color prototype containing one cyan origin plus 1-3 cyan targets; copy the prototype at every target and paint conflicting overlaps maroon.

parametric familyoverlap handlingprototype extractionrelative translation

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 (nonzero-components grid)
      (let loop ([remaining (filter-cells grid (lambda (r c v) (not (= v 0))))] [acc (list)])
        (if (empty? remaining)
            (reverse acc)
            (let* ((start (first remaining))
                   (cells (connected-region grid (first start) (second start)
                            (lambda (r c v) (not (= v 0))) 4)))
              (loop (filter (lambda (p) (not (member? p cells))) remaining)
                    (cons cells acc))))))
    (define (contains-color? cells color)
      (any? (lambda (p) (= (at g (first p) (second p)) color)) cells))
    (define (component< a b)
      (let ((ba (bbox-of-cells a)) (bb (bbox-of-cells b)))
        (cond [(not (= (length a) (length b))) (> (length a) (length b))]
              [(not (= (first ba) (first bb))) (< (first ba) (first bb))]
              [else (< (second ba) (second bb))])))
    (define (overlay-one out template origin anchor)
      (let ((top (- (first anchor) (first origin)))
            (left (- (second anchor) (second origin))))
        (for*/fold ([acc out])
                   ([r (in-range (rows template))]
                    [c (in-range (cols template))]
                    #:when (not (= (at template r c) 0)))
          (let ((rr (+ top r)) (cc (+ left c)) (v (at template r c)))
            (if (in-bounds? rr cc (rows acc) (cols acc))
                (let ((old (at acc rr cc)))
                  (cond [(= old 0) (set-cell acc rr cc v)]
                        [(= old v) acc]
                        [else (set-cell acc rr cc 9)]))
                acc)))))
    (let* ((proto (first (sort (filter (lambda (cells)
                                         (and (> (length cells) 1) (contains-color? cells 8)))
                                       (nonzero-components g))
                                component<)))
           (bb (bbox-of-cells proto))
           (template (subgrid g (first bb) (second bb) (third bb) (fourth bb)))
           (origin (first (find-color template 8)))
           (abs-origin (list (+ (first bb) (first origin)) (+ (second bb) (second origin))))
           (anchors (cons abs-origin (filter (lambda (p) (not (member? p proto))) (find-color g 8)))))
      (for/fold ([out (empty-grid (rows g) (cols g) 0)]) ([anchor (in-list anchors)])
        (overlay-one out template origin anchor)))))

Provenance

Generator
generators/75ff4423494a/generator.py
Notes and decisions
generators/75ff4423494a/notes.md
Review label
reviewed_safe
Generator SHA-256
c3edb921acbb5111e3c9600d166742bdfd1fd7a831b12e54a9a09e559e58c88f
Rule hash
0124781298a5
Sources
bank:63dac95f0c67
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 75ff4423494a --count 1 --seed 20261108 --test 1