diff options
author | Vincent Ambo <mail@tazj.in> | 2020-12-01T12·12+0100 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2020-12-01T12·55+0000 |
commit | 6c08bcc84d51fd5a1a5152b3c611df44c93a3f00 (patch) | |
tree | e630b752c08018aded887c2708e29a30f9ab716d /fun/aoc2019/solution-day1.el | |
parent | 7d7c15c9a69d1d88f66640285ce08eaa3b60078e (diff) |
chore(tazjin/aoc2019): Move out of //fun r/1970
Change-Id: I9d065b672f4245b81444737dd900c8864447bc4d Reviewed-on: https://cl.tvl.fyi/c/depot/+/2211 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'fun/aoc2019/solution-day1.el')
-rw-r--r-- | fun/aoc2019/solution-day1.el | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/fun/aoc2019/solution-day1.el b/fun/aoc2019/solution-day1.el deleted file mode 100644 index d805c22ec870..000000000000 --- a/fun/aoc2019/solution-day1.el +++ /dev/null @@ -1,28 +0,0 @@ -;; Advent of Code 2019 - Day 1 -(require 'dash) - -;; Puzzle 1: - -(defvar day-1/input - '(83285 96868 121640 51455 128067 128390 141809 52325 68310 140707 124520 149678 - 87961 52040 133133 52203 117483 85643 84414 86558 65402 122692 88565 61895 - 126271 128802 140363 109764 53600 114391 98973 124467 99574 69140 144856 - 56809 149944 138738 128823 82776 77557 51994 74322 64716 114506 124074 - 73096 97066 96731 149307 135626 121413 69575 98581 50570 60754 94843 72165 - 146504 53290 63491 50936 79644 119081 70218 85849 133228 114550 131943 - 67288 68499 80512 148872 99264 119723 68295 90348 146534 52661 99146 95993 - 130363 78956 126736 82065 77227 129950 97946 132345 107137 79623 148477 - 88928 118911 75277 97162 80664 149742 88983 74518)) - -(defun calculate-fuel (mass) - (- (/ mass 3) 2)) - -(message "Solution to day1/1: %d" (apply #'+ (-map #'calculate-fuel day-1/input))) - -;; Puzzle 2: -(defun calculate-recursive-fuel (mass) - (let ((fuel (calculate-fuel mass))) - (if (< fuel 0) 0 - (+ fuel (calculate-recursive-fuel fuel))))) - -(message "Solution to day1/2: %d" (apply #'+ (-map #'calculate-recursive-fuel day-1/input))) |