day 18, part 2 complete, with a little bit ugly

This commit is contained in:
efim 2022-12-22 20:41:17 +00:00
parent 831f09c9cd
commit 598500e289
2 changed files with 7 additions and 3 deletions

View File

@ -155,8 +155,12 @@
(fill-outside-with-2 '(0 0 0) *day-18-input-connectivity*) (fill-outside-with-2 '(0 0 0) *day-18-input-connectivity*)
(count-open-sides-to-outside *day-18-input-connectivity*) (count-open-sides-to-outside *day-18-input-connectivity*)
;; 2484 - not correct, too low
;; there's 1 at the edge of the array. whoops. so there are 0s in the input? ;; there's 1 at the edge of the array. whoops. so there are 0s in the input?
;; yep. so now what, shift all by 1? and add one more +1 to the find max? ;; yep. so now what, shift all by 1? and add one more +1 to the find max?
;; hahaha, this is stupid. ;; hahaha, this is stupid.
;; but let's do it ;; but let's do it
(coords-from-input "day18-test.txt") ; yep. +1
;; 2490

View File

@ -11,9 +11,9 @@
(defun find-maxes (all-coords) (defun find-maxes (all-coords)
(loop (loop
for (x y z) in all-coords for (x y z) in all-coords
maximize (+ x 2) into xs maximize (+ x 3) into xs
maximize (+ y 2) into ys maximize (+ y 3) into ys
maximize (+ z 2) into zs maximize (+ z 3) into zs
finally (return (list xs ys zs))) ) finally (return (list xs ys zs))) )
(defun fill-connectivity-array (all-coords connectivity-matrix) (defun fill-connectivity-array (all-coords connectivity-matrix)