-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpather.go
More file actions
26 lines (21 loc) · 817 Bytes
/
pather.go
File metadata and controls
26 lines (21 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package walker
import "github.com/beefsack/go-astar"
type pather struct {
Vertex
Neighbors []astar.Pather
Distances map[astar.Pather]uint
}
// PathNeighbors returns the list of neighbors of a Vertex.
func (p *pather) PathNeighbors() []astar.Pather {
return p.Neighbors
}
// PathNeighborCost returns the distance between the pather and its neighbor.
func (p *pather) PathNeighborCost(to astar.Pather) float64 {
return 1 / float64(p.Distances[to]+1)
}
// PathEstimatedCost returns the heuristic distance between p and the target.
// We return 0 because because we cannot estimate the distance using Manhattan approach.
// Using 0 fallsback to Dijkstra's algorythm. See http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html
func (p *pather) PathEstimatedCost(to astar.Pather) float64 {
return 0
}