aoc2023/day-17/two.go

15 lines
382 B
Go
Raw Normal View History

2023-12-22 21:56:07 +00:00
package main
2023-12-23 11:58:21 +00:00
// two returns the lowest cost path for a given graph from start to end coords
2023-12-22 21:56:07 +00:00
// 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
}