← c1fd38e5812b · c235e3da14f4 →

c21f2ce8fb20

A gray field contains three or four separated rectangular 0/2 chambers. Count red cells in each chamber; paint the unique maximum chamber cyan on a blank output. Scheduled examples refute exact-three, largest-room, and highest-density shortcuts.

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))
        (best-score #f)
        (best-cells (list)))
    (define (better? score old)
      (or (not old)
          (> (first score) (first old))
          (and (= (first score) (first old))
               (or (> (second score) (second old))
                   (and (= (second score) (second old))
                        (string<? (third score) (third old)))))))
    (define (cell<? a b)
      (or (< (first a) (first b))
          (and (= (first a) (first b)) (< (second a) (second b)))))
    (for* ([r (in-range (rows g))] [c (in-range (cols g))])
      (unless (or (hash-has-key? seen (cons r c)) (not (member? (at g r c) (list 0 2))))
        (define queue (list (cons r c)))
        (define cells (list))
        (hash-set! seen (first queue) #t)
        (let bfs ([fuel 0])
          (unless (empty? queue)
            (let ((cur (first queue)))
              (set! queue (rest queue))
              (set! cells (cons (list (car cur) (cdr cur)) cells))
              (for ([d (in-list cardinal-deltas)])
                (let ((nr (+ (car cur) (first d))) (nc (+ (cdr cur) (second d))))
                  (when (and (in-bounds? nr nc (rows g) (cols g))
                             (member? (at g nr nc) (list 0 2))
                             (not (hash-has-key? seen (cons nr nc))))
                    (hash-set! seen (cons nr nc) #t)
                    (set! queue (append queue (list (cons nr nc))))))))
            (bfs (+ fuel 1))))
        (let* ((sorted-cells (sort cells cell<?))
               (seeds (count-where (lambda (p) (= (at g (first p) (second p)) 2)) sorted-cells))
               (score (list seeds (length sorted-cells) (format "~a" (first sorted-cells)))))
          (when (better? score best-score)
            (set! best-score score)
            (set! best-cells sorted-cells)))))
    (paint-cells (empty-grid (rows g) (cols g) 0) best-cells 8)))

Provenance

Generator
generators/c21f2ce8fb20/generator.py
Notes and decisions
generators/c21f2ce8fb20/notes.md
Review label
reviewed_safe
Generator SHA-256
999a65888862995bc9a4b69dbef1e8d2d79db2bd2ad41cdaaaf6877f8cd8ec20
Rule hash
b86be3a37a68
Sources
bank:e00836ab832d
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate c21f2ce8fb20 --count 1 --seed 20261108 --test 1