astar

package module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: MIT Imports: 2 Imported by: 0

README

github.com/gbkr-com/astar

The A* path finding algorithm.

The package contains a sample application which illustrates how the algorithm finds paths.

screenshot

The landscape for path finding comprises cells with varying colours: the darker the colour the higher the cost of passing through the cell. The darkest cells are blocked. The objective for the algorithm is to find the lowest cost path from the top left to the bottom right of the landscape.

Use the Randomisebutton to change the landscape: then use theRoute button to show the path.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Find

func Find(problem Interface, start, goal int) []int

Find the route from the start to the goal. If no route is feasible then return nil.

Types

type Interface

type Interface interface {

	// Adjacent returns a map of the adjacent points with their associated
	// cost.
	//
	Adjacent(int) map[int]float64

	// Estimate returns the estimated cost of moving from the given point to the
	// goal. Known as the heuristic function (h) in the literature.
	//
	Estimate(int, int) float64
}

Interface defines the problem space for the A* algorithm. Whatever the implemention, every point in the problem space must have a unique integer label.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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