Make everything work again.
This commit is contained in:
parent
78f9fb6e0b
commit
66e2d48eaa
2
d12.py
2
d12.py
@ -39,7 +39,7 @@ def solve(lines: list[str], repeat=1):
|
||||
all = []
|
||||
for (_, line) in enumerate(lines):
|
||||
springs, numbers = line.split()
|
||||
numbers = tuple(lib.str_to_int_list(numbers))
|
||||
numbers = tuple(lib.str_to_ints(numbers))
|
||||
ns = "?".join([springs for _ in range(repeat)])
|
||||
all.append((tuple(ns), numbers * repeat))
|
||||
|
||||
|
3
d19.py
3
d19.py
@ -140,10 +140,9 @@ def main():
|
||||
# 25:00
|
||||
|
||||
print("Example 2:", solve(Input(EXAMPLE), True))
|
||||
print("Correct 2:", 167409079868000)
|
||||
assert solve(Input(EXAMPLE), True) == 167409079868000
|
||||
print("Solution 2:", solve(Input(DAY_INPUT), True))
|
||||
# 120:00
|
||||
return
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
1
d20.py
1
d20.py
@ -103,6 +103,7 @@ def main():
|
||||
print("Example 2:", solve(Input(EXAMPLE2)))
|
||||
print("Solution 1:", solve(Input(DAY_INPUT)))
|
||||
print("Solution 2:", solve(Input(DAY_INPUT), True))
|
||||
assert solve(Input(DAY_INPUT), True) == 244178746156661
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
4
d9.py
4
d9.py
@ -9,7 +9,7 @@ EXAMPLE = """
|
||||
def solve(lines: list[str]):
|
||||
res = 0
|
||||
for (i, line) in enumerate(lines):
|
||||
digits = lib.str_to_int_list(line)
|
||||
digits = lib.str_to_ints(line)
|
||||
last_digits = []
|
||||
while not all(d == 0 for d in digits):
|
||||
last_digits.append(digits[-1])
|
||||
@ -24,7 +24,7 @@ def solve(lines: list[str]):
|
||||
def solve2(lines: list[str]):
|
||||
res = 0
|
||||
for (i, line) in enumerate(lines):
|
||||
digits = lib.str_to_int_list(line)
|
||||
digits = lib.str_to_ints(line)
|
||||
first_digits = []
|
||||
while not all(d == 0 for d in digits):
|
||||
first_digits.append(digits[0])
|
||||
|
Reference in New Issue
Block a user