treewide: fix 'dijkstra' typo

The downside of copy-pasting snippets from previous solutions :').
This commit is contained in:
Bruno BELANYI 2025-05-20 02:03:36 +01:00
parent ef539ad5cb
commit 785205eac7
10 changed files with 20 additions and 20 deletions

View file

@ -92,7 +92,7 @@ def solve(input: str) -> int:
for gear in (Gear.TORCH, Gear.NEITHER):
yield 1 + (7 if gear != explorer.gear else 0), Explorer(n, gear)
def djikstra(start: Explorer, end: Explorer, cave: Cave) -> int:
def dijkstra(start: Explorer, end: Explorer, cave: Cave) -> int:
# Priority queue of (distance, point)
queue = [(0, start)]
seen: set[Explorer] = set()
@ -116,7 +116,7 @@ def solve(input: str) -> int:
cave = Cave(depth, target)
start = Explorer(Point(0, 0), Gear.TORCH)
end = Explorer(target, Gear.TORCH)
return djikstra(start, end, cave)
return dijkstra(start, end, cave)
def main() -> None:

View file

@ -73,7 +73,7 @@ def solve(input: str) -> int:
graph = to_graph(paths, post_process_gates(letters, paths))
return graph, next(iter(gates["AA"])), next(iter(gates["ZZ"]))
def djikstra(start: Point, end: Point, graph: Graph) -> int:
def dijkstra(start: Point, end: Point, graph: Graph) -> int:
# Priority queue of (distance, point)
queue = [(0, start)]
seen: set[Point] = set()
@ -94,7 +94,7 @@ def solve(input: str) -> int:
assert False # Sanity check
graph, start, end = parse(input.splitlines())
return djikstra(start, end, graph)
return dijkstra(start, end, graph)
def main() -> None:

View file

@ -87,7 +87,7 @@ def solve(input: str) -> int:
graph = to_graph(paths, post_process_gates(letters, paths))
return graph, next(iter(gates["AA"])), next(iter(gates["ZZ"]))
def djikstra(start: Point, end: Point, graph: Graph) -> int:
def dijkstra(start: Point, end: Point, graph: Graph) -> int:
# Priority queue of (distance, point, level)
queue = [(0, start, 0)]
seen: set[tuple[Point, int]] = set()
@ -112,7 +112,7 @@ def solve(input: str) -> int:
assert False # Sanity check
graph, start, end = parse(input.splitlines())
return djikstra(start, end, graph)
return dijkstra(start, end, graph)
def main() -> None:

View file

@ -22,7 +22,7 @@ def solve(input: List[str]) -> int:
continue
yield Point(x, y)
def djikstra(start: Point, end: Point) -> int:
def dijkstra(start: Point, end: Point) -> int:
# Priority queue of (distance, point)
queue = [(0, start)]
seen: Set[Point] = set()
@ -42,7 +42,7 @@ def solve(input: List[str]) -> int:
assert False # Sanity check
return djikstra(Point(0, 0), Point(len(levels) - 1, len(levels[0]) - 1))
return dijkstra(Point(0, 0), Point(len(levels) - 1, len(levels[0]) - 1))
def main() -> None:

View file

@ -43,7 +43,7 @@ def solve(input: List[str]) -> int:
continue
yield Point(x, y)
def djikstra(start: Point, end: Point) -> int:
def dijkstra(start: Point, end: Point) -> int:
# Priority queue of (distance, point)
queue = [(0, start)]
seen: Set[Point] = set()
@ -63,7 +63,7 @@ def solve(input: List[str]) -> int:
assert False # Sanity check
return djikstra(Point(0, 0), Point(len(levels) - 1, len(levels[0]) - 1))
return dijkstra(Point(0, 0), Point(len(levels) - 1, len(levels[0]) - 1))
def main() -> None:

View file

@ -51,7 +51,7 @@ def solve(input: list[str]) -> int:
assert end is not None # Sanity check
return HeightMap(heights, start, end)
def djikstra(map: HeightMap) -> int:
def dijkstra(map: HeightMap) -> int:
# Priority queue of (distance, point)
queue = [(0, map.start)]
seen: set[Point] = set()
@ -72,7 +72,7 @@ def solve(input: list[str]) -> int:
assert False # Sanity check
map = to_height_map(input)
return djikstra(map)
return dijkstra(map)
def main() -> None:

View file

@ -51,7 +51,7 @@ def solve(input: list[str]) -> int:
assert end is not None # Sanity check
return HeightMap(heights, start, end)
def djikstra(map: HeightMap) -> int:
def dijkstra(map: HeightMap) -> int:
# Priority queue of (distance, point)
queue = [(0, map.start)]
seen: set[Point] = set()
@ -81,7 +81,7 @@ def solve(input: list[str]) -> int:
)
for start in starts:
map.start = start
yield djikstra(map)
yield dijkstra(map)
map = to_height_map(input)
return min(hike_distances(map))

View file

@ -73,7 +73,7 @@ def solve(input: str) -> int:
assert end is not None # Sanity check
return ParsedMaze(start, end, blocks)
def djikstra(start: Point, end: Point, blocks: set[Point]) -> int:
def dijkstra(start: Point, end: Point, blocks: set[Point]) -> int:
def next_moves(
pos: Point,
dir: Direction,
@ -106,7 +106,7 @@ def solve(input: str) -> int:
assert False # Sanity check
start, end, blocks = parse(input.splitlines())
return djikstra(start, end, blocks)
return dijkstra(start, end, blocks)
def main() -> None:

View file

@ -27,7 +27,7 @@ def solve(input: str) -> int:
def parse(input: list[str]) -> list[Point]:
return [Point(*map(int, line.split(","))) for line in input]
def djikstra(start: Point, end: Point, blocks: set[Point]) -> int:
def dijkstra(start: Point, end: Point, blocks: set[Point]) -> int:
# Priority queue of (distance, point)
queue = [(0, start)]
seen: set[Point] = set()
@ -54,7 +54,7 @@ def solve(input: str) -> int:
assert False # Sanity check
coords = parse(input.splitlines())
return djikstra(Point(0, 0), DIMS, set(coords[:1024]))
return dijkstra(Point(0, 0), DIMS, set(coords[:1024]))
def main() -> None:

View file

@ -27,7 +27,7 @@ def solve(input: str) -> str:
def parse(input: list[str]) -> list[Point]:
return [Point(*map(int, line.split(","))) for line in input]
def djikstra(start: Point, end: Point, blocks: set[Point]) -> int | None:
def dijkstra(start: Point, end: Point, blocks: set[Point]) -> int | None:
# Priority queue of (distance, point)
queue = [(0, start)]
seen: set[Point] = set()
@ -58,7 +58,7 @@ def solve(input: str) -> str:
low, high = 0, len(blocks)
while low < high:
mid = low + (high - low) // 2
if djikstra(start, end, set(blocks[: mid + 1])) is None:
if dijkstra(start, end, set(blocks[: mid + 1])) is None:
high = mid
else:
low = mid + 1