Skip to content

Commit f98edfd

Browse files
committed
[2024/13] include plus sign in button parsing (so in theory it would also work with negative offsets), add solve() return type annotation
1 parent 4528397 commit f98edfd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

2024/13/script.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from GhostyUtils.vec2 import Vec2
33

44

5-
def solve(machine: list[list[tuple], tuple], offset: int = 0):
5+
def solve(machine: list[list[tuple], tuple], offset: int = 0) -> int:
66
a, b = [Vec2(button) for button in machine[0]]
77
p = Vec2(machine[1]) + Vec2(offset, offset)
88

@@ -30,7 +30,7 @@ def main():
3030
machines = []
3131
for mch in inputs:
3232
mch = mch.splitlines()
33-
buttons = [tuple(int(coord[2:])
33+
buttons = [tuple(int(coord[1:])
3434
for coord in btn.split(': ')[1].split(', '))
3535
for btn in mch[:2]]
3636
prize = tuple(int(coord[2:]) for coord in mch[2].split(': ')[1].split(', '))

0 commit comments

Comments
 (0)