-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,5 @@ | |
(:file "day17") | ||
(:file "day18") | ||
(:file "day19") | ||
(:file "day23"))) | ||
(:file "day23") | ||
(:file "day25"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))))) |