mirror of
https://github.com/onyx-and-iris/aoc2023.git
synced 2024-11-15 15:10:49 +00:00
15 lines
357 B
Go
15 lines
357 B
Go
|
package main
|
||
|
|
||
|
// two returns the lowest cost path from start to end
|
||
|
// with a min/max distance set
|
||
|
func two(lines []string) int {
|
||
|
graph := buildGraph(lines)
|
||
|
|
||
|
start := newCoords(0, 0)
|
||
|
end := newCoords(len(graph[0])-1, len(graph)-1)
|
||
|
dijkstra := newDijkstra(graph, WithMinDistance(4), WithMaxDistance(10))
|
||
|
cost := dijkstra.run(start, end)
|
||
|
|
||
|
return cost
|
||
|
}
|