Skip to content

Commit 051b8fd

Browse files
committed
2024 Day 13 Part 2 Complete
1 parent 2c448ea commit 051b8fd

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

2024/13/daily.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,16 @@ def part1(input_text):
6969
return sum
7070

7171
def part2(input_text):
72-
return 0
72+
machines = parse(input_text)
73+
sum = 0
74+
for machine in machines:
75+
prize = machine['prize']
76+
prize = (prize[0] + 10000000000000, prize[1] + 10000000000000)
77+
machine['prize'] = prize
78+
tokens = solver(machine)
79+
if tokens:
80+
sum += cost(tokens)
81+
return sum
7382

7483
if __name__ == "__main__":
7584
with open(__file__.rsplit('/', 1)[0] + "/input.txt", 'r') as file:

2024/13/daily_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ def test_cost(parsed_data):
4646
assert cost([38, 86]) == 200
4747

4848
def test_part1(sample_data):
49-
breakpoint()
5049
assert part1(sample_data) == 480
5150

52-
# def test_part2(sample_data):
53-
# assert part2(sample_data) == 81
51+
def test_part2(sample_data):
52+
assert part2(sample_data) == 875318608908

0 commit comments

Comments
 (0)