diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-10-30 15:16:54 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-10-30 22:33:27 +0000 |
commit | de4c5bbd5351bff29a2197233d2f0e2f3b1681e1 (patch) | |
tree | 6fa2dca1402cf3ccdba565635bd38e09da0e2aa6 /2019/puzzle-1.py | |
parent | d357964e2fed2096badd684ac08f6a8a566e143c (diff) | |
download | advent-of-code-de4c5bbd5351bff29a2197233d2f0e2f3b1681e1.tar.gz advent-of-code-de4c5bbd5351bff29a2197233d2f0e2f3b1681e1.tar.bz2 advent-of-code-de4c5bbd5351bff29a2197233d2f0e2f3b1681e1.zip |
Fixup some stuff
Diffstat (limited to '2019/puzzle-1.py')
-rw-r--r-- | 2019/puzzle-1.py | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/2019/puzzle-1.py b/2019/puzzle-1.py deleted file mode 100644 index a6fffbd..0000000 --- a/2019/puzzle-1.py +++ /dev/null @@ -1,24 +0,0 @@ -from math import floor - -def fuel(mass): - return (floor(mass / 3)) - 2 - -def read_input(): - with open("1-input", "r") as fp: - return [int(line) for line in fp.readlines()] - -def round_1(): - print(f"round 1: {sum([fuel(mass) for mass in read_input()])}") - -def recursive_fuel(mass): - new_fuel = (floor(mass / 3)) - 2 - if new_fuel <= 0: - return 0 - return new_fuel + recursive_fuel(new_fuel) - -def round_2(): - print(f"round 2: {sum([recursive_fuel(mass) for mass in read_input()])}") - -if __name__ == '__main__': - round_1() - round_2() |