rudolph

package
v0.0.0-...-223f09d Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorCoordinate = Coordinate{math.MinInt, math.MinInt}

Functions

func AStarInit

func AStarInit[T any](end Coordinate, initialData [][]T, emptyMap IAStarMap[T])

func AStarReset

func AStarReset[T any](aStarMap IAStarMap[T])

func AStarRun

func AStarRun[T any](start, end Coordinate, aStarMap IAStarMap[T])

func DifferenceDistance

func DifferenceDistance[T stockings.Integral](a T, b T) int

func ManhattanDistance

func ManhattanDistance(a, b Coordinate) int

Types

type AStarMap

type AStarMap[T any] struct {
	IAStarMap[T]
	MapNodes [][]*MapNode[T]
}

func (*AStarMap[T]) Get

func (m *AStarMap[T]) Get(coords Coordinate) *MapNode[T]

type Coordinate

type Coordinate struct {
	Col, Row int
}

func ParseCoordinate

func ParseCoordinate(coord string) (Coordinate, error)

func (*Coordinate) Equals

func (c *Coordinate) Equals(other Coordinate) bool

func (*Coordinate) String

func (c *Coordinate) String() string

type IAStarMap

type IAStarMap[T any] interface {
	TravelCost(src, dst Coordinate) int
	Heuristic(src, dst Coordinate) int
	GetConnectedNodes(src Coordinate) []Coordinate
	Get(coords Coordinate) *MapNode[T]
	SetMap(m [][]*MapNode[T])
	GetMap() [][]*MapNode[T]
}

type MapNode

type MapNode[T any] struct {
	Value          T
	TravelScore    int
	HeuristicScore int
	Self           Coordinate
	Predecessor    Coordinate
}

Jump to

Keyboard shortcuts

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