pfind

package
v0.0.0-...-4ede3f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2022 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NeighborsDiag = []geo.Pos{
	{X: -1, Y: -1},
	{X: 0, Y: -1},
	{X: 1, Y: -1},
	{X: -1, Y: 0},
	{X: 1, Y: 0},
	{X: -1, Y: 1},
	{X: 0, Y: 1},
	{X: 1, Y: 1},
}
View Source
var NeighborsRect = []geo.Pos{
	{X: 0, Y: -1},
	{X: -1, Y: 0},
	{X: 1, Y: 0},
	{X: 0, Y: 1},
}

Functions

func HeurDiag

func HeurDiag(scale, diag int) func(from, to geo.Pos) int

func HeurManhattan

func HeurManhattan(scale int) func(from, to geo.Pos) int

Types

type Graph

type Graph interface {
	Heur() Heur
	Near(geo.Pos, func(geo.Pos, int))
}

type Heap

type Heap struct {
	Data []Node
}

func (*Heap) Find

func (h *Heap) Find(p geo.Pos) int

func (*Heap) Len

func (h *Heap) Len() int

func (*Heap) Less

func (h *Heap) Less(i, j int) bool

func (*Heap) Pop

func (h *Heap) Pop() (v any)

func (*Heap) Push

func (h *Heap) Push(v any)

func (*Heap) Swap

func (h *Heap) Swap(i, j int)

func (*Heap) Upsert

func (h *Heap) Upsert(p geo.Pos, cost int)

type Heur

type Heur func(from, to geo.Pos) int

type Hist

type Hist struct {
	Score int
	From  *geo.Pos
}

type Node

type Node struct {
	geo.Pos
	Cost int
}

func FindPath

func FindPath(g Graph, start, goal geo.Pos) ([]Node, error)

FindPath uses a focused D* search algorithm for a generic graph see https://en.wikipedia.org/wiki/D*

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL