← public_eval_5961cc34 · public_eval_62593bfd →

public_eval_5dbc8537

Pack external colored rectangles into an irregular target mask without rotating pieces.

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!
 ;; The modal input color is background. The largest other color is the
 ;; target frame, whose bounding rectangle is the output domain.
 ;; External multicolor rectangular pieces must tile all target background
 ;; cells by translation only. Row-major first-hole search backtracks over
 ;; the complete inventory and carries the resulting positioned pieces.
 ;; Preserve frame cells and the internal orientation/colors of every piece.
 (lambda (g)
  (let ()
   (define bg (pick-max (grid-colors g) (lambda (x) (count-color g x))))
   (define frame (pick-max (grid-colors g bg) (lambda (x) (count-color g x))))
   (define bb (bbox-of-cells (find-color g frame)))
   (define board (subgrid g (first bb) (second bb) (third bb) (fourth bb)))
   (define outside
    (grid-from-fn (rows g) (cols g)
     (lambda (r c)
      (if (and (<= (first bb) r) (<= r (third bb))
               (<= (second bb) c) (<= c (fourth bb))) bg (at g r c)))))
   (define pieces
    (map (lambda (obj) (subgrid outside (obj-r1 obj) (obj-c1 obj) (obj-r2 obj) (obj-c2 obj)))
         (objects-multicolor outside bg)))
   (define (covered r c piece)
    (positions-in-rect r c (+ r (rows piece) -1) (+ c (cols piece) -1)))
   (define (search holes inventory)
    (if (null? holes) '()
     (let* ((anchor (first holes)) (r (first anchor)) (c (second anchor)))
      (let try ((options inventory))
       (if (null? options) #f
        (let* ((piece (first options)) (used (covered r c piece)))
         (if (andmap (lambda (p) (member p holes)) used)
          (let ((tail (search (filter (lambda (p) (not (member p used))) holes)
                              (remove piece inventory))))
           (if tail (cons (list r c piece) tail) (try (rest options))))
          (try (rest options)))))))))
   (define placed (search (find-color board bg) pieces))
   (define selected-frame frame)
   (define assembled
    (for/fold ((out board)) ((record placed))
     (for*/fold ((acc out)) ((r (range (rows (third record)))) (c (range (cols (third record)))))
      (set-cell acc (+ (first record) r) (+ (second record) c) (at (third record) r c)))))
   (grid-from-fn (rows board) (cols board)
    (lambda (r c) (if (= (at board r c) frame) selected-frame (at assembled r c)))))))

Provenance

Generator
generators/public_eval_5dbc8537/generator.py
Notes and decisions
generators/public_eval_5dbc8537/notes.md
Review label
reviewed_safe
Generator SHA-256
5f398939f168268fc2c4c95fa69b997da6aeec21ef6e938e7791384cc3a5e571
Rule hash
670c4f61d3df
Sources
evaluation, public_eval:5dbc8537
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate public_eval_5dbc8537 --count 1 --seed 20261108 --test 1