grids

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

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

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GridNode

type GridNode struct {
	X          int
	Y          int
	Cost       float64
	IsObstacle bool
	// contains filtered or unexported fields
}

GridNode grid node

func (*GridNode) ActualDistanceToNeighbor

func (n *GridNode) ActualDistanceToNeighbor(node astar.Node) float64

ActualDistanceToNeighbor get distance to a neighbor

func (*GridNode) EstimateDistanceToGoal

func (n *GridNode) EstimateDistanceToGoal(goal astar.Node) float64

EstimateDistanceToGoal get distance to the goal

func (*GridNode) GetNeighbors

func (n *GridNode) GetNeighbors() []astar.Node

GetNeighbors get neighbors

type GridWorld

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

GridWorld grid world

func New

func New(rows, columns int) *GridWorld

New creates a 2D grid of nodes

func (*GridWorld) Get

func (n *GridWorld) Get(i int, j int) *GridNode

Get retrieves a Grid Node

func (*GridWorld) IsValid

func (n *GridWorld) IsValid(i int, j int) bool

IsValid checks whether coordinates are within the grid

func (*GridWorld) PrintGrid

func (n *GridWorld) PrintGrid(nodes []astar.Node)

PrintGrid prints a Grid

Jump to

Keyboard shortcuts

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