← e5dc3d423bd9 · e5ec1ac39df5 →

e5ead55c33e7

Colored objects slide rightward until they pack against a gray wall.

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!
  (let ((dummy 0))
    (define movable
      (sort (filter (lambda (o) (or (= (obj-color o) 2) (= (obj-color o) 3) (= (obj-color o) 4))) (objects g 0))
            (lambda (a b)
              (if (= (obj-c2 a) (obj-c2 b))
                  (> (obj-r1 a) (obj-r1 b))
                  (> (obj-c2 a) (obj-c2 b))))))
    (define cleared (foldl (lambda (obj acc) (erase-cells acc (obj-cells obj) 0)) g movable))
    (define occupied
      (for/set ([cell (in-list (grid-cells cleared))] #:when (= (third cell) 5))
        (cons (first cell) (second cell))))
    (define (blocked? cells occ)
      (any? (lambda (p)
              (or (not (in-bounds? (first p) (second p) (rows g) (cols g)))
                  (set-member? occ (cons (first p) (second p)))))
            cells))
    (define (shift cells) (map (lambda (p) (list (first p) (+ (second p) 1))) cells))
    (define (slide-cells cells occ)
      (let loop ([cur cells])
        (let ((nxt (shift cur)))
          (if (blocked? nxt occ) cur (loop nxt)))))
    (let-values ([(out final-occ)
                  (for/fold ([out cleared] [occ occupied]) ([obj (in-list movable)])
                    (let* ((landed (slide-cells (obj-cells obj) occ))
                           (new-out (paint-cells out landed (obj-color obj)))
                           (new-occ (for/fold ([o occ]) ([p (in-list landed)])
                                      (set-add o (cons (first p) (second p))))))
                      (values new-out new-occ)))])
      out)))

Provenance

Generator
generators/e5ead55c33e7/generator.py
Notes and decisions
generators/e5ead55c33e7/notes.md
Review label
reviewed_safe
Generator SHA-256
bf12902e37902fe7b2ac9ee789625957fdc7d6bab7c2e59cda104525e0e55e5f
Rule hash
c33b0d90067d
Sources
bank:54d03287ae93
Lesson seeds
20261108, 20261109, 20261110, 20261111, 20261112
Reproduce lesson 1
arcpuzzles generate e5ead55c33e7 --count 1 --seed 20261108 --test 1