-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate_code.py
More file actions
37 lines (25 loc) · 824 Bytes
/
template_code.py
File metadata and controls
37 lines (25 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""AoC {DAY}, {YEAR}."""
# Standard library imports
import pathlib
import sys
INPUT_FILE = "input.txt"
def parse_data(puzzle_input: str):
"""Parse input."""
def part1(data):
"""Solve part 1."""
def part2(data):
"""Solve part 2."""
def solve(puzzle_input):
"""Solve the puzzle for the given input."""
data = parse_data(puzzle_input)
yield part1(data)
yield part2(data)
if __name__ == "__main__":
if len(sys.argv) > 1:
path = sys.argv[1]
print(f"\n{path}:")
solutions = solve(puzzle_input=pathlib.Path(path).read_text().rstrip())
print("\n".join(str(solution) for solution in solutions))
else:
solutions = solve(puzzle_input=pathlib.Path(INPUT_FILE).read_text().rstrip())
print("\n".join(str(solution) for solution in solutions))