advent-of-code/2021/template.py

37 lines
794 B
Python
Raw Normal View History

2021-12-04 10:55:01 +01:00
from typing import List
2021-12-03 12:08:16 +01:00
def main(filename: str, expected_part_1: int = None, expected_part_2: int = None):
print(f"\n+ Running on {filename}")
with open(filename) as f:
data = f.read().strip().split("\n")
2021-12-04 10:55:01 +01:00
data = parse_data(data)
solution_part_1 = solve_part_1(data)
2021-12-03 12:08:16 +01:00
2021-12-04 10:55:01 +01:00
print(f"1. Found {solution_part_1}")
2021-12-03 12:08:16 +01:00
if expected_part_1:
2021-12-04 10:55:01 +01:00
assert expected_part_1 == solution_part_1
2021-12-03 12:08:16 +01:00
2021-12-04 10:55:01 +01:00
solution_part_2 = solve_part_2(data)
print(f"2. Found {solution_part_2}")
2021-12-03 12:08:16 +01:00
if expected_part_2:
2021-12-04 10:55:01 +01:00
assert expected_part_2 == solution_part_2
def parse_data(data: List[str]):
return data
2021-12-03 12:08:16 +01:00
2021-12-04 10:55:01 +01:00
def solve_part_1(data) -> int:
2021-12-03 12:08:16 +01:00
return 0
2021-12-04 10:55:01 +01:00
def solve_part_2(data) -> int:
2021-12-03 12:08:16 +01:00
return 0
if __name__ == "__main__":
main("inputs/dayXX-test1")
main("inputs/dayXX")