diff --git a/src/assets/day_5_test.txt b/src/assets/day_5_test.txt new file mode 100644 index 0000000..f756727 --- /dev/null +++ b/src/assets/day_5_test.txt @@ -0,0 +1,33 @@ +seeds: 79 14 55 13 + +seed-to-soil map: +50 98 2 +52 50 48 + +soil-to-fertilizer map: +0 15 37 +37 52 2 +39 0 15 + +fertilizer-to-water map: +49 53 8 +0 11 42 +42 0 7 +57 7 4 + +water-to-light map: +88 18 7 +18 25 70 + +light-to-temperature map: +45 77 23 +81 45 19 +68 64 13 + +temperature-to-humidity map: +0 69 1 +1 0 69 + +humidity-to-location map: +60 56 37 +56 93 4 diff --git a/src/modules/__tests__/test_day_5.py b/src/modules/__tests__/test_day_5.py new file mode 100644 index 0000000..f8550f2 --- /dev/null +++ b/src/modules/__tests__/test_day_5.py @@ -0,0 +1,5 @@ +from src.modules.day_5 import Almanac + + +def test_almanac(): + almanac = Almanac(r"src/assets/day_5_test.txt") diff --git a/src/modules/day_5.py b/src/modules/day_5.py new file mode 100644 index 0000000..fbddda1 --- /dev/null +++ b/src/modules/day_5.py @@ -0,0 +1,28 @@ +import re + + +def run(): + almanac = Almanac("src/assets/day_5_test.txt") + + +class Almanac: + seed_to_soil: list[int] + soil_to_fertilizer: list[int] + fertilizer_to_water: list[int] + wat_to_light_to_light: list[int] + light_to_temperature: list[int] + temperature_to_humidity: list[int] + humidity_to_location: list[int] + + def __init__(self, path: str): + self.load_maps(path) + + def parse_map(self, input: str) -> list[int]: + l = [] + return l + + def load_maps(self, path: str): + with open(path) as file: + file_str = file.read() + found = re.search(r"seed-to-soil map:\s\n(.*)", file_str) + print(found)