Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoPath = goErrs.New("no path found")
Functions ¶
func Search ¶
func Search[S State, TileType TileWithCost]( m *Map[TileType], start S, isGoal func(S) bool, neighbours func(S) []S, h func(from S) int, pathHeadFlag TileType, pathTailFlag TileType, ) (cost int, path []Pos, err error)
Search performs an A* search on the given map from the start position to the goal position.
h is the heuristic function that returns the estimated cost from the given position to the goal. func Search[TileType TileWithCost](m *Map[TileType], start Pos, goal Pos, h func(from Pos) int, recordFrames bool, pathHeadFlag TileType, pathTailFlag TileType) (cost int, path []Pos, err error) {
Types ¶
type DirectionalPos ¶
type Node ¶
type Node[S State] struct { State S Parent *Node[S] // The cheapest Parent Node (nil if this is the start Node) // contains filtered or unexported fields }
Node represents a Node in the A* search
type State ¶
type State interface { comparable Pos() maps.Pos }
type TileWithCost ¶
type TileWithCost interface { Tile // Cost returns the cost to move onto this tile on the map Cost() int }
Click to show internal directories.
Click to hide internal directories.