WIP: day 5 file read
This commit is contained in:
1 parent
17d8c24da4
commit
e948de6b27
3 files changed
+66
No files matched your search
@@ -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
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
from src.modules.day_5 import Almanac
|
||||||
|
|
||||||
|
|
||||||
|
def test_almanac():
|
||||||
|
almanac = Almanac(r"src/assets/day_5_test.txt")
|
||||||
@@ -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)
|
||||||
Reference in new issue
Block a user