← 28c998e193d9 · 28e5fbc279ab →

28cb867ad3f0

Fill each 4-connected zero chamber with its unique plurality boundary marker color from 1..4. Tied or empty votes leave that chamber zero; color-5 walls and all marker cells are preserved.

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!
  ;; Mutable lookup table for seen
  (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/28cb867ad3f0/generator.py
Notes and decisions
generators/28cb867ad3f0/notes.md
Review label
reviewed_safe
Generator SHA-256
402c0cb6bc5f73f1cbd70a739f4792dd4e1f398c27e239b383a7a9cfc4977324
Rule hash
56654a66f781
Sources
bank:385e738e9e70
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 28cb867ad3f0 --count 1 --seed 20261108 --test 1