Skip to content

Commit

Permalink
Day 25 Part 1
Browse files Browse the repository at this point in the history
Solution for day 25 - well first part only. Need all of the stars for the second part. I suspect there will be no more coding required though.
  • Loading branch information
abraemer committed Dec 25, 2018
1 parent d44e6df commit a647ac6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion advent-of-code-2018.asd
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@
(:file "day17")
(:file "day18")
(:file "day19")
(:file "day23")))
(:file "day23")
(:file "day25")))
17 changes: 17 additions & 0 deletions day25.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
;;;; day25.lisp

(in-package :advent-of-code-2018)

(defun day25-make-in-range-p (p1)
(lambda (p2) (<= (manhattan p1 p2) 3)))

(defun day25 ()
(loop
:for p :in (mapcar #'extract-integers (read-puzzlefile "input25.txt"))
:for sets := (list (list p)) :then (loop :for set :in sets
:if (some (lambda (p2) (in-range-p p p2)) set)
:append set :into in-range
:else
:collect set :into other
:finally (return (cons (cons p in-range) other)))
:finally (return (format t "There are ~a constellations.~%" (length sets)))))

0 comments on commit a647ac6

Please sign in to comment.