Skip to content

Commit

Permalink
[2024/13] include plus sign in button parsing (so in theory it would …
Browse files Browse the repository at this point in the history
…also work with negative offsets), add solve() return type annotation
  • Loading branch information
StarlitGhost committed Dec 13, 2024
1 parent 4528397 commit f98edfd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 2024/13/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from GhostyUtils.vec2 import Vec2


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

Expand Down Expand Up @@ -30,7 +30,7 @@ def main():
machines = []
for mch in inputs:
mch = mch.splitlines()
buttons = [tuple(int(coord[2:])
buttons = [tuple(int(coord[1:])
for coord in btn.split(': ')[1].split(', '))
for btn in mch[:2]]
prize = tuple(int(coord[2:]) for coord in mch[2].split(': ')[1].split(', '))
Expand Down

0 comments on commit f98edfd

Please sign in to comment.