This commit is contained in:
thib8956 committed 2026-11-11 15:36:53 +01:00
1 parent 0232b9326d
commit 5c3fb89870
50 files changed
+97 -117

No files matched your search

+1 -3
View File
@@ -25,9 +25,7 @@ def test_part2():
expected = (2, 966, 50346)
for i, inp in enumerate(inputs):
result = calculate_fuel_iterative(inp)
assert result == expected[i], "Result for {} should be {}, was {}".format(
inp, expected[i], result
)
assert result == expected[i], f"Result for {inp} should be {expected[i]}, was {result}"
print("All tests passed for part 2.")
+3 -4
View File
@@ -1,9 +1,8 @@
import time
import math
import cmath
from itertools import combinations
from collections import defaultdict
import math
from bisect import insort
from collections import defaultdict
from itertools import combinations
def dist(a, b):
+1 -1
View File
@@ -1,4 +1,4 @@
from adventofcode.intcode import interpret_intcode, Interpreter
from adventofcode.intcode import Interpreter
def paint(program, initial_state):
+1 -1
View File
@@ -39,7 +39,7 @@ def parse_map(output):
grid[x, y] = tile
paddle = next((k for k, v in grid.items() if v == 3), None)
ball = next((k for k, v in grid.items() if v == 4), None)
bounds = (max(x for x, y in grid.keys()), max(y for x, y in grid.keys()))
bounds = (max(x for x, y in grid), max(y for x, y in grid))
return grid, bounds, score, paddle, ball
+2 -6
View File
@@ -54,9 +54,7 @@ def tests():
expected = (6, 159, 135)
for i, inp in enumerate(inputs):
result = find_min_distance(inp[0], inp[1])
assert result == expected[i], "Result for {} should be {}, was {}".format(
inp, expected[i], result
)
assert result == expected[i], f"Result for {inp} should be {expected[i]}, was {result}"
# Part 2
# expected number of steps
@@ -64,9 +62,7 @@ def tests():
print("All tests passed.")
for i, inp in enumerate(inputs):
result = find_least_steps(inp[0], inp[1])
assert result == expected_part2[i], "Result for {} should be {}, was {}".format(
inp, expected_part2[i], result
)
assert result == expected_part2[i], f"Result for {inp} should be {expected_part2[i]}, was {result}"
if __name__ == "__main__":
tests()
+2 -3
View File
@@ -1,9 +1,8 @@
#! /usr/bin/env python3
from collections import namedtuple
from enum import Enum
import logging
from enum import Enum
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.WARN)
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.WARNING)
def get_nth_digit(n, number):
-1
View File
@@ -93,7 +93,6 @@ class HaltInstruction(Instruction):
def execute(self, intcode, arguments):
intcode.halted = True
return None
class Argument:
-1
View File
@@ -1,4 +1,3 @@
from collections import defaultdict
def path(graph, start, goal):
+3 -3
View File
@@ -1,7 +1,7 @@
import sys
from pathlib import Path
from itertools import cycle, permutations
from adventofcode.intcode import interpret_intcode, Interpreter
from adventofcode.intcode import Interpreter, interpret_intcode
def main(inp):
mem = list(map(int, inp.readline().rstrip().split(",")))