aboutsummaryrefslogtreecommitdiff
path: root/2015/day-06/day-06.rkt
diff options
context:
space:
mode:
Diffstat (limited to '2015/day-06/day-06.rkt')
-rw-r--r--2015/day-06/day-06.rkt9
1 files changed, 4 insertions, 5 deletions
diff --git a/2015/day-06/day-06.rkt b/2015/day-06/day-06.rkt
index 2cafa4e..d2eed08 100644
--- a/2015/day-06/day-06.rkt
+++ b/2015/day-06/day-06.rkt
@@ -10,7 +10,8 @@
(define instructions
(for/list ([l (in-lines (open-day 6 2015))])
(~>> l
- (regexp-match #px"(turn on|toggle|turn off) (\\d{1,3}),(\\d{1,3}) through (\\d{1,3}),(\\d{1,3})")
+ (regexp-match
+ #px"(turn on|toggle|turn off) (\\d{1,3}),(\\d{1,3}) through (\\d{1,3}),(\\d{1,3})")
rest
make-instruction)))
@@ -30,8 +31,7 @@
(for ([y (inclusive-range (instruction-y1 inst) (instruction-y2 inst))])
(vector2d-modify! light-grid x y (using inst)))))
-(define light-grid
- (make-vector (* 1000 1000) #false))
+(define light-grid (make-vector (* 1000 1000) #false))
(for ([i (in-list instructions)])
(modify-light-grid i light-grid todo))
(vector-count identity light-grid)
@@ -43,8 +43,7 @@
['|turn off| (λ (x) (max 0 (sub1 x)))]
['|toggle| (curry + 2)]))
-(define dimmable-grid
- (make-vector (* 1000 1000) 0))
+(define dimmable-grid (make-vector (* 1000 1000) 0))
(for ([i (in-list instructions)])
(modify-light-grid i dimmable-grid todo-dimmer))
(apply + (vector->list dimmable-grid))