← 9ff30d18e156 · a0076c1c960c →

9ffa0c8841bb

Fill each zero chamber with its unique plurality boundary-marker color; ties stay zero.

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 ((seen (make-hash))
        (out g))
    (define (mode-unique vals)
      (let* ((colors (remove-duplicates vals))
             (ranked (sort (map (lambda (color) (list color (count-where (lambda (v) (= v color)) vals))) colors)
                           (lambda (a b) (> (second a) (second b))))))
        (cond [(empty? ranked) #f]
              [(= (length ranked) 1) (first (first ranked))]
              [(> (second (first ranked)) (second (second ranked))) (first (first ranked))]
              [else #f])))
    (for* ([r (in-range (rows g))] [c (in-range (cols g))])
      (when (and (not (hash-has-key? seen (cons r c))) (= (at g r c) 0))
        (define queue (list (cons r c)))
        (define chamber (list))
        (define boundary (list))
        (hash-set! seen (first queue) #t)
        (let bfs ([step 0])
          (unless (empty? queue)
            (let ((cur (first queue)))
              (set! queue (rest queue))
              (set! chamber (cons (list (car cur) (cdr cur)) chamber))
              (for ([d (in-list cardinal-deltas)])
                (let ((nr (+ (car cur) (first d)))
                      (nc (+ (cdr cur) (second d))))
                  (when (in-bounds? nr nc (rows g) (cols g))
                    (cond [(and (= (at g nr nc) 0) (not (hash-has-key? seen (cons nr nc))))
                           (hash-set! seen (cons nr nc) #t)
                           (set! queue (append queue (list (cons nr nc))))]
                          [(and (>= (at g nr nc) 1) (<= (at g nr nc) 4))
                           (set! boundary (cons (at g nr nc) boundary))])))))
            (bfs (+ step 1))))
        (let ((color (mode-unique boundary)))
          (when color
            (set! out (paint-cells out chamber color))))))
    out))

Provenance

Generator
generators/9ffa0c8841bb/generator.py
Notes and decisions
generators/9ffa0c8841bb/notes.md
Review label
reviewed_safe
Generator SHA-256
7cd846b1e234ca2a58778fe205041dc2a34d69aa3cc1002ee8c129abfa6c4383
Rule hash
e1d60c5dd3e1
Sources
bank:0d41ded5f4cd
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 9ffa0c8841bb --count 1 --seed 20261108 --test 1