treewide: fix 'dijkstra' typo
The downside of copy-pasting snippets from previous solutions :').
This commit is contained in:
parent
7dee19ff44
commit
b4d9ecf0a5
10 changed files with 20 additions and 20 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue