We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 51e7f11 commit 81a5501Copy full SHA for 81a5501
day18/src/Day18.java
@@ -35,10 +35,13 @@ private static record Board(List<List<Character>> rows) {
35
public final OptionalInt findShortestPath() {
36
// Your run-of-the-mill Dijkstra implementation.
37
38
- // We could probably optimize this a bit by adding one of the A*
+ // Note 1: We could probably optimize this a bit by adding one of the A*
39
// heuristics (e.g. use abs(pos.x - end.x) + abs(pos.y - end.y) to
40
// estimate the distance to the goal), but this works well enough.
41
42
+ // Note 2: BFS would have probably already worked, since we're dealing
43
+ // with distances of 1 on a grid... but hey, it works!
44
+
45
Vec2 start = getStart();
46
Vec2 end = getEnd();
47
0 commit comments