mirror of
https://github.com/thib8956/advent-of-code.git
synced 2026-11-27 00:46:34 +00:00
fix lint
This commit is contained in:
1 parent
0232b9326d
commit
5c3fb89870
50 files changed
+97
-117
No files matched your search
@@ -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.")
|
||||
|
||||
|
||||
|
||||
@@ -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,4 +1,4 @@
|
||||
from adventofcode.intcode import interpret_intcode, Interpreter
|
||||
from adventofcode.intcode import Interpreter
|
||||
|
||||
|
||||
def paint(program, initial_state):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -93,7 +93,6 @@ class HaltInstruction(Instruction):
|
||||
|
||||
def execute(self, intcode, arguments):
|
||||
intcode.halted = True
|
||||
return None
|
||||
|
||||
|
||||
class Argument:
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from collections import defaultdict
|
||||
|
||||
|
||||
def path(graph, start, goal):
|
||||
|
||||
@@ -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(",")))
|
||||
|
||||
Reference in new issue
Block a user