vooga.aiEngine.Algorithms
Class AStar

java.lang.Object
  extended by vooga.aiEngine.Algorithms.AbstractAlgorithm
      extended by vooga.aiEngine.Algorithms.AStar

public class AStar
extends AbstractAlgorithm

AStar.java

Author:
Cody Freeman An A* algorithm implemented to accept an input file containing the x- and y-coordinates of points including a beginning position and goal position. The A* search continuously updates an admissible heuristic based on the distance from a beginning point to the end point. According to Russell and Novig's "Artificial Intelligence - A Modern Approach", 3rd ed., the A* search assigns numerical values to all possible nodes following the formula f(n) = g(n) + h(n) where f(n) is the estimated cost of the cheapest solution through n, g(n) is the distance traveled so far to the goal, and h(n) is the estimated remaining distance to the end point. In this case h(n) will be considered to be zero, as the game will not likely provide for an infinite number of possible moves.

Constructor Summary
AStar()
           
 
Method Summary
 void perform(java.lang.Object... args)
          Performs an arbitrary algorithm with arbitrary parameters.
 void search(java.lang.String filename)
          Search currently runs a demo program that find the smallest distances between two points.
 
Methods inherited from class vooga.aiEngine.Algorithms.AbstractAlgorithm
performWithDelay, setDelay
 
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

search

public void search(java.lang.String filename)
            throws java.io.FileNotFoundException
Search currently runs a demo program that find the smallest distances between two points. This can be updated by adding in constraints to make it a real A* Search instead of just a few for loops.

Parameters:
args -
Throws:
java.io.FileNotFoundException

perform

public void perform(java.lang.Object... args)
             throws java.lang.RuntimeException
Description copied from class: AbstractAlgorithm
Performs an arbitrary algorithm with arbitrary parameters. Defines the basic parameters of an algorithm. Algorithms generally require a number of EventObjects which the algorithm fires according to certain specifications.

Specified by:
perform in class AbstractAlgorithm
Throws:
java.lang.RuntimeException