Day 19: Forgot to revert experimental changes.
This commit is contained in:
parent
279d5a6ae7
commit
499da3826a
|
@ -26,11 +26,6 @@
|
||||||
(match-let ([(list x y z) change])
|
(match-let ([(list x y z) change])
|
||||||
(+ (abs x) (abs y) (abs z))))
|
(+ (abs x) (abs y) (abs z))))
|
||||||
|
|
||||||
(define (deltas region)
|
|
||||||
(for*/set ([beacon1 region]
|
|
||||||
[beacon2 region])
|
|
||||||
(abs (magnitude (delta beacon1 beacon2)))))
|
|
||||||
|
|
||||||
(define rotations
|
(define rotations
|
||||||
(for*/fold ([rotations '()])
|
(for*/fold ([rotations '()])
|
||||||
([dx '(1 -1)]
|
([dx '(1 -1)]
|
||||||
|
@ -51,7 +46,6 @@
|
||||||
(values region (map #{set-map region %} rotations))))
|
(values region (map #{set-map region %} rotations))))
|
||||||
|
|
||||||
(define (combine region1 region2)
|
(define (combine region1 region2)
|
||||||
(and (>= (set-count (set-intersect (deltas region1) (deltas region2))) 66)
|
|
||||||
(for*/or ([beacon1 region1]
|
(for*/or ([beacon1 region1]
|
||||||
[beacon2 region2])
|
[beacon2 region2])
|
||||||
(define change (delta beacon1 beacon2))
|
(define change (delta beacon1 beacon2))
|
||||||
|
@ -59,7 +53,7 @@
|
||||||
(set-map region2 #{shift % (delta beacon1 beacon2)}))
|
(set-map region2 #{shift % (delta beacon1 beacon2)}))
|
||||||
(and (>= (set-count (set-intersect region1 shifted-region2)) 12)
|
(and (>= (set-count (set-intersect region1 shifted-region2)) 12)
|
||||||
(cons (set-union region1 shifted-region2)
|
(cons (set-union region1 shifted-region2)
|
||||||
change)))))
|
change))))
|
||||||
|
|
||||||
(define-values (part1 part2)
|
(define-values (part1 part2)
|
||||||
(time
|
(time
|
||||||
|
|
Loading…
Reference in New Issue