Hemisson
Tjerk Kostelijk & Anne Schuth
<-- BACK TO CLASSES

Class AStar

java.lang.Object
  extended byAStar

public class AStar
extends java.lang.Object

An implementation of the A* algoritm. It is goal directed and only returns full paths.


Constructor Summary
AStar()
           
 
Method Summary
static void fetchFamily(Node n, Node nStart, NodeList path)
          Recursive method that fetches all the nodes, starting with the goal and following the parents.
static int getManhattanDist(Node nA, Node nB)
          Calculates the manhattan-distance between two nodes
static NodeList getNeighbours(NodeList world, Node nCurrent, Node nGoal)
          Makes a NodeList holding all the neighbour Nodes using 4-connectivity.
static NodeList run(NodeList world, Node nGoal, Node nStartInit)
          The main method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AStar

public AStar()
Method Detail

run

public static NodeList run(NodeList world,
                           Node nGoal,
                           Node nStartInit)
The main method.

Parameters:
world - Nodelist containing a world
nGoal - The goal node
Returns:
A NodeList with Nodes forming the path

fetchFamily

public static void fetchFamily(Node n,
                               Node nStart,
                               NodeList path)
Recursive method that fetches all the nodes, starting with the goal and following the parents.


getManhattanDist

public static int getManhattanDist(Node nA,
                                   Node nB)
Calculates the manhattan-distance between two nodes


getNeighbours

public static NodeList getNeighbours(NodeList world,
                                     Node nCurrent,
                                     Node nGoal)
Makes a NodeList holding all the neighbour Nodes using 4-connectivity.

Parameters:
world - Nodelist containing a world
nCurrent - The currentnode
nGoal - the goal node

Hemisson
Tjerk Kostelijk & Anne Schuth
<-- BACK TO CLASSES