algorithm

package
v0.0.0-...-5e01725 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AStar

func AStar(m storage.Interface, h Heuristic, start, end co.Interface) ([]co.Interface, bool)

AStar implements the A* algorithm for hexagonal coordinates

func Reachable

func Reachable(storage storage.Interface, start co.Interface, movement int) []co.Interface

Types

type Heuristic

type Heuristic func(m *storage.Interface, start, end co.Interface) int

Heuristic defines a template to make custom heuristics

type Item

type Item struct {
	// contains filtered or unexported fields
}

type PriorityQueue

type PriorityQueue []*Item

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

Len implements sort.Interface

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

Less implements sort.Interface

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

Pop implements heap.Interface

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

Push implements heap.Interface

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

Swap implements sort.Interface

func (*PriorityQueue) Update

func (pq *PriorityQueue) Update(item *Item, cost, priority int, parent []coordinate.Interface)

Update adjusts the priority of something on the heap

Jump to

Keyboard shortcuts

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