Created
December 9, 2021 03:01
-
-
Save tdrhq/779f43917d5439f8314484ec727b1e64 to your computer and use it in GitHub Desktop.
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
(let ((points (mapcar #'parse-integer (str:split "," (car (uiop:read-file-lines "~/builds/web/input")))))) | |
(let ((state (make-array 10 :initial-element 0))) | |
(loop for point in points do | |
(incf (aref state point))) | |
(loop for day below 256 do | |
(progn | |
(let ((new (aref state 0))) | |
(loop for i from 0 below 8 do | |
(setf (aref state i) | |
(aref state (1+ i)))) | |
(incf (aref state 6) new) | |
(setf (aref state 8) new)))) | |
(loop for x across state summing x))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment