Use new AoC infrastructure and clean up.

This commit is contained in:
2023-12-27 22:02:59 -05:00
parent 4e8bd8a60c
commit a449964cbe
9 changed files with 26 additions and 134 deletions

18
lib.py
View File

@@ -1,18 +0,0 @@
import re
def str_to_single_int(line: str) -> int:
line = line.replace(" ", "")
r = re.compile(r"-?\d+")
for m in r.findall(line):
return int(m)
raise Exception("No single digit sequence in '{line}'")
def str_to_int_list(line: str) -> list[int]:
r = re.compile(r"-?\d+")
return list(map(int, r.findall(line)))
def str_to_lines_no_empty(text: str) -> list[str]:
return list(filter(lambda l: l.strip() != "", text.splitlines()))
def str_to_lines(text: str) -> list[str]:
return list(text.splitlines())

1
lib.py Symbolic link
View File

@@ -0,0 +1 @@
../aoc2023/lib.py