Packagecom.lookbackon.ds.aStar
Classpublic class AStar
InheritanceAStar Inheritance AbstractProcess Inheritance Object

In computer science, A(pronounced "A star") is a computer algorithm that is widely used in pathfinding and graph traversal, the process of plotting an efficiently traversable path between points, called nodes. Noted for its performance and accuracy, it enjoys widespread use. Peter Hart, Nils Nilsson and Bertram Raphael first described the algorithm in 1968.[1] It is an extension of Edsger Dijkstra's 1959 algorithm. Aachieves better performance (with respect to time) by using heuristics.

See also

http://www.policyalmanac.org/games/aStarTutorial.htm
http://theory.stanford.edu/~amitp/GameProgramming/AStarComparison.html


Public Properties
 PropertyDefined By
  grid : AStarNodeBoard
AStar
  heuristic : Function
AStar
 InheritedisSelfManaging : Boolean
AbstractProcess
  path : Array
[read-only]
AStar
  percentage : Number
[override] [read-only] inheritDoc
AStar
  processDone : Boolean
AStar
  visited : Array
[read-only]
AStar
Protected Properties
 PropertyDefined By
 Inherited_isSelfManaging : Boolean
AbstractProcess
Public Methods
 MethodDefined By
  
AStar(isSelfManaging:Boolean = false)
AStar
  
diagonal(node:AStarNode):Number
The standard heuristic for a square grid is the Diagonal distance.
AStar
  
euclidian(node:AStarNode):Number
The standard heuristic for a square grid is the Euclidean distance.
AStar
  
manhattan(node:AStarNode):Number
The standard heuristic for a square grid is the Manhattan distance.
AStar
  
run():void
[override] Like all informed search algorithms, it first searches the routes that appear to be most likely to lead towards the goal.
AStar
 Inherited
runAndManage(allocation:int):void
AbstractProcess
 Inherited
terminate():void
AbstractProcess
 Inherited
yield():void
AbstractProcess
Property Detail
gridproperty
grid:AStarNodeBoard


Implementation
    public function get grid():AStarNodeBoard
    public function set grid(value:AStarNodeBoard):void
heuristicproperty 
heuristic:Function


Implementation
    public function get heuristic():Function
    public function set heuristic(value:Function):void
pathproperty 
path:Array  [read-only]


Implementation
    public function get path():Array
percentageproperty 
percentage:Number  [read-only] [override]

inheritDoc


Implementation
    public function get percentage():Number
processDoneproperty 
processDone:Boolean


Implementation
    public function get processDone():Boolean
    public function set processDone(value:Boolean):void
visitedproperty 
visited:Array  [read-only]


Implementation
    public function get visited():Array
Constructor Detail
AStar()Constructor
public function AStar(isSelfManaging:Boolean = false)



Parameters
isSelfManaging:Boolean (default = false)
Method Detail
diagonal()method
public function diagonal(node:AStarNode):Number

The standard heuristic for a square grid is the Diagonal distance. On a square grid that allows 8 directions of movement, use Diagonal distance (L∞).

Parameters

node:AStarNode — AStarNode carried some node info.

Returns
Number — Diagonal distance

See also

euclidian()method 
public function euclidian(node:AStarNode):Number

The standard heuristic for a square grid is the Euclidean distance. On a square grid that allows any direction of movement, you might or might not want Euclidean distance (L2). If Ais finding paths on the grid but you are allowing movement not on the grid, you may want to consider other representations of the map.

Parameters

node:AStarNode — AStarNode carried some node info.

Returns
Number — Euclidean distance

See also

manhattan()method 
public function manhattan(node:AStarNode):Number

The standard heuristic for a square grid is the Manhattan distance. On a square grid that allows 4 directions of movement, use Manhattan distance (L1).

Parameters

node:AStarNode — AStarNode carried some node info.

Returns
Number — Manhattan distance

See also

run()method 
override public function run():void

Like all informed search algorithms, it first searches the routes that appear to be most likely to lead towards the goal.