← d35dbdf1cfc2 · d377a54f20c6 →

d3633a9fb1cd

Two separated color-5 framed rooms contain one or two distinct-colored seeds each. Zero cells take the color of their unique nearest seed by four-neighbour shortest-path distance through non-wall cells; ties stay zero. Some lessons include an attached interior wall that makes geodesic distance disagree with a Manhattan shortcut.

geodesic_voronoi

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 seeds
      (filter (lambda (cell) (and (not (= (third cell) 0)) (not (= (third cell) 5)))) (grid-cells g)))
    (define dist (make-hash))
    (define owners (make-hash))
    (define queue (list))
    (for ([cell (in-list seeds)])
      (define p (list (first cell) (second cell)))
      (hash-set! dist p 0)
      (hash-set! owners p (list (third cell)))
      (set! queue (append queue (list p))))
    (define (uniq xs) (remove-duplicates xs))
    (define (search)
      (unless (empty? queue)
        (define cur (first queue))
        (set! queue (rest queue))
        (define curd (hash-ref dist cur))
        (define curo (hash-ref owners cur))
        (for ([d (in-list cardinal-deltas)])
          (define nr (+ (first cur) (first d)))
          (define nc (+ (second cur) (second d)))
          (define p (list nr nc))
          (when (and (in-bounds? nr nc (rows g) (cols g)) (not (= (at g nr nc) 5)))
            (define nd (+ curd 1))
            (cond [(not (hash-has-key? dist p))
                   (hash-set! dist p nd)
                   (hash-set! owners p curo)
                   (set! queue (append queue (list p)))]
                  [(= nd (hash-ref dist p))
                   (hash-set! owners p (uniq (append (hash-ref owners p) curo)))])))
        (search)))
    (search)
    (grid-from-fn (rows g) (cols g)
      (lambda (r c)
        (let ((v (at g r c)) (p (list r c)))
          (cond [(= v 5) v]
                [(not (= v 0)) v]
                [(not (hash-has-key? dist p)) 0]
                [else
                 (let ((os (hash-ref owners p)))
                   (if (= (length os) 1) (first os) 0))]))))))

Provenance

Generator
generators/d3633a9fb1cd/generator.py
Notes and decisions
generators/d3633a9fb1cd/notes.md
Review label
reviewed_safe
Generator SHA-256
9f4712ba17e90e8418b30ad432ae12825229bc0d23dc52f639a90e12b1355b5f
Rule hash
2c2e8f36a1dd
Sources
bank:f4425e302da7
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate d3633a9fb1cd --count 1 --seed 20261108 --test 1