path

package
v0.0.0-...-b838528 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell int
const (
	Free Cell = iota
	Blocked
	PathPoint
)

type Coordinate

type Coordinate struct {
	X int
	Y int
}

func NewCoord

func NewCoord(x int, y int) *Coordinate

func (*Coordinate) String

func (c *Coordinate) String() string

type Map

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

func NewMap

func NewMap(size int, obstacles ...*Obstacle) *Map

func (*Map) Draw

func (m *Map) Draw()

func (*Map) DrawPath

func (m *Map) DrawPath(path Path)

func (*Map) GetNeighbours

func (m *Map) GetNeighbours(coord *Coordinate) []*Coordinate

func (*Map) IsFree

func (m *Map) IsFree(coord *Coordinate) bool

type Obstacle

type Obstacle struct {
	From Coordinate
	To   Coordinate
}

func NewObstacle

func NewObstacle(x1 int, y1 int, x2 int, y2 int) *Obstacle

type Path

type Path []*Coordinate

func AStar

func AStar(m *Map, from *Coordinate, to *Coordinate) Path

func BreadthFirst

func BreadthFirst(m *Map, from *Coordinate, to *Coordinate) Path

func Djikstra

func Djikstra(m *Map, from *Coordinate, to *Coordinate) Path

func GreedyBreadthFirst

func GreedyBreadthFirst(m *Map, from *Coordinate, to *Coordinate) Path

func (Path) String

func (p Path) String() string

type PathFinder

type PathFinder func(*Map, *Coordinate, *Coordinate) Path

Jump to

Keyboard shortcuts

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