← public_eval_332f06d7 · public_eval_36a08778 →

public_eval_35ab12c3

Complete aligned angular-neighbor edges, then translate completed shapes from adjacent singleton markers.

parametric family

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!
 ;; For each non-background color, order its original cells by angle around
 ;; their centroid.  Join consecutive cells (closing the polygon) only when
 ;; they share a row, column, or 45-degree diagonal.  Then treat a singleton
 ;; color adjacent to exactly one differently colored original cell as a
 ;; translated shadow marker: copy that target color's completed polygon by
 ;; the marker-to-anchor offset, painting background only.
 (lambda (g)
  (let ()
   (define bg (mode g -1))
   (define edge-mode 'all_8)
   (define colors (filter (lambda (v) (not (= v bg))) (grid-colors g)))
   (define (inside? p)
    (and (<= 0 (first p)) (< (first p) (rows g))
         (<= 0 (second p)) (< (second p) (cols g))))
   (define (ordered cells)
    (if (<= (length cells) 1) cells
     (let ()
      (define n (length cells))
      (define sr (apply + (map first cells)))
      (define sc (apply + (map second cells)))
      (define (vec p) (list (- (* n (first p)) sr) (- (* n (second p)) sc)))
      (define (angle p) (let ((v (vec p))) (atan (first v) (second v))))
      (define (radius2 p) (let ((v (vec p))) (+ (* (first v) (first v)) (* (second v) (second v)))))
      (sort cells
       (lambda (a b)
        (let ((aa (angle a)) (ab (angle b)))
         (if (= aa ab)
             (if (= (radius2 a) (radius2 b))
                 (or (< (first a) (first b))
                     (and (= (first a) (first b)) (< (second a) (second b))))
                 (< (radius2 a) (radius2 b)))
             (< aa ab))))))))
   (define (aligned? a b)
    (define dr (- (first b) (first a)))
    (define dc (- (second b) (second a)))
    (or (= dr 0) (= dc 0)
        (and (equal? edge-mode 'all_8) (= (abs dr) (abs dc)))))
   (define (segment a b)
    (if (not (aligned? a b)) '()
     (let ()
      (define dr (- (first b) (first a)))
      (define dc (- (second b) (second a)))
      (define steps (max (abs dr) (abs dc)))
      (define sr (cond ((< dr 0) -1) ((> dr 0) 1) (else 0)))
      (define sc (cond ((< dc 0) -1) ((> dc 0) 1) (else 0)))
      (for/list ((k (range (+ steps 1))))
       (list (+ (first a) (* k sr)) (+ (second a) (* k sc)))))))
   (define (complete cells)
    (define ring (ordered cells))
    (define n (length ring))
    (define edge-count (cond ((< n 2) 0) ((= n 2) 1) (else n)))
    (remove-duplicates
     (append cells
      (for/fold ((all '())) ((i (range edge-count)))
       (append all (segment (list-ref ring i) (list-ref ring (modulo (+ i 1) n))))))))
   (define completed
    (map (lambda (color) (list color (complete (find-color g color)))) colors))
   (define (cells-for color) (second (assoc color completed)))
   (define (paint-bg out cells color)
    (for/fold ((acc out)) ((p cells))
     (if (= (at acc (first p) (second p)) bg)
         (set-cell acc (first p) (second p) color)
         acc)))
   (define base
    (for/fold ((out g)) ((entry completed))
     (paint-bg out (second entry) (first entry))))
   (for/fold ((out base)) ((color colors))
    (define markers (find-color g color))
    (if (not (= (length markers) 1)) out
     (let ()
      (define marker (first markers))
      (define anchors
       (filter
        (lambda (p)
         (and (inside? p)
              (not (= (at g (first p) (second p)) bg))
              (not (= (at g (first p) (second p)) color))))
        (map (lambda (d) (list (+ (first marker) (first d)) (+ (second marker) (second d)))) all-8-deltas)))
      (if (not (= (length anchors) 1)) out
       (let ()
        (define anchor (first anchors))
        (define target (at g (first anchor) (second anchor)))
        (define dr (- (first marker) (first anchor)))
        (define dc (- (second marker) (second anchor)))
        (define shifted
         (map (lambda (p) (list (+ (first p) dr) (+ (second p) dc))) (cells-for target)))
        (paint-bg out (filter inside? shifted) color)))))))))

Provenance

Generator
generators/public_eval_35ab12c3/generator.py
Notes and decisions
generators/public_eval_35ab12c3/notes.md
Review label
reviewed_safe
Generator SHA-256
54f7689e3a62a2308cf3a69535a96ed1d800acced126fc45958d2ed261ace27f
Rule hash
4da69ff64802
Sources
evaluation, public_eval:35ab12c3
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate public_eval_35ab12c3 --count 1 --seed 20261108 --test 1