← 36adc51834d3 · 371eb0221101 →

36b22ff07a2e

Find the dominant outer-border color and the dominant non-border field color. The field encloses a rectangular matrix of rooms. Replace each room by its unique marker color, or by the outer-border color when the room is empty, preserving the room matrix's row/column order.

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! (lambda (g)
         (let* ((border-vals (append (map (lambda (c) (at g 0 c)) (range 0 w))
                                     (map (lambda (c) (at g (- h 1) c)) (range 0 w))
                                     (map (lambda (r) (at g r 0)) (range 0 h))
                                     (map (lambda (r) (at g r (- w 1))) (range 0 h))))
                (bg (mode-list border-vals))
                (frame-color (mode g bg))
                (objs (objects-multicolor g frame-color))
                (sub-regions (filter (lambda (o) (not (bordering? o g))) objs))
                (sub-info (map (lambda (o)
                                 (let* ((non-bg-cells (filter (lambda (p)
                                                                (!= bg
                                                                    (at g
                                                                        (fst p)
                                                                        (snd p))))
                                                              (obj-cells o)))
                                        (marker (if (null? non-bg-cells)
                                                    bg
                                                    (at g
                                                        (fst (first non-bg-cells))
                                                        (snd (first non-bg-cells))))))
                                   (list (obj-r1 o)
                                         (obj-r2 o)
                                         (obj-c1 o)
                                         (obj-c2 o)
                                         marker)))
                               sub-regions))
                (assign-row-idx (lambda (sub)
                                  (let* ((sr1 (nth sub 0))
                                         (sorted-rows (sort-by (unique (map (lambda (s)
                                                                              (nth s 0))
                                                                            sub-info))
                                                               (lambda (x) x))))
                                    (count-if (lambda (r) (< r sr1)) sorted-rows))))
                (assign-col-idx (lambda (sub)
                                  (let* ((sc1 (nth sub 2))
                                         (sorted-cols (sort-by (unique (map (lambda (s)
                                                                              (nth s 2))
                                                                            sub-info))
                                                               (lambda (x) x))))
                                    (count-if (lambda (c) (< c sc1)) sorted-cols))))
                (num-rows (length (unique (map (lambda (s) (nth s 0)) sub-info))))
                (num-cols (length (unique (map (lambda (s) (nth s 2)) sub-info)))))
           (build-grid num-rows
                       num-cols
                       (r c)
                       (let ((matching (filter (lambda (s)
                                                 (and
                                                   (= r (assign-row-idx s))
                                                   (= c (assign-col-idx s))))
                                               sub-info)))
                         (if (null? matching) bg (nth (first matching) 4)))))))

Provenance

Generator
generators/36b22ff07a2e/generator.py
Notes and decisions
generators/36b22ff07a2e/notes.md
Review label
reviewed_safe
Generator SHA-256
b431e0398642719e0f191d00715f34f7e83412376860b41078650d6424529fa9
Rule hash
24e4023e7c9d
Sources
augmented, training
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate 36b22ff07a2e --count 1 --seed 20261108 --test 1