AIILE.gridworld.util.hint
Class GridHint

java.lang.Object
  extended byAIILE.gridworld.util.hint.GridHint

public class GridHint
extends java.lang.Object

This class provides hints about the agents direction, the direction of the goal and the distance to the goal.


Constructor Summary
GridHint()
          Creates a new instance of GridHint
GridHint(java.lang.String dir, int cx, int cy, int gx, int gy)
          Creates a new instance of GridHint
 
Method Summary
 float getDirectionOfGoal()
          This provides the direction of the goal from the current node, in degrees, where North is 0 deg, East is 90 deg, South is 180 deg, and West is 270 degrees.
 float getDirectSightDistance()
          This is the same as the above getDirectSightDistance but the assumed node weight is a constant 1.
 float getDirectSightDistance(int assumedNodeWeight)
          This provides a very simple calculation of the distance from the current node to the goal.
 java.lang.String getNodeDirection()
          This provides the name of the direction of the node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridHint

public GridHint()
Creates a new instance of GridHint


GridHint

public GridHint(java.lang.String dir,
                int cx,
                int cy,
                int gx,
                int gy)
Creates a new instance of GridHint

Method Detail

getNodeDirection

public java.lang.String getNodeDirection()
This provides the name of the direction of the node. North, south, east, or west.

Returns:
String
See Also:
AIILE.gridworld.util.Direction

getDirectSightDistance

public float getDirectSightDistance(int assumedNodeWeight)
This provides a very simple calculation of the distance from the current node to the goal. The equation looks like this: d = sqrt((gx-cx)^2 + (gy-cy)^2) where the cx and cy are the current position in the grid and gx and gy are the goal position. This is line of sight distance or "as the birds fly" distance. The parameter is the distance from one node to another. The default is 1, this assumes it takes one move to go the distance of one node.

Parameters:
assumedNodeWeight - this is the distance from one node to another, default is 1
Returns:
float

getDirectSightDistance

public float getDirectSightDistance()
This is the same as the above getDirectSightDistance but the assumed node weight is a constant 1.

Returns:
float

getDirectionOfGoal

public float getDirectionOfGoal()
This provides the direction of the goal from the current node, in degrees, where North is 0 deg, East is 90 deg, South is 180 deg, and West is 270 degrees. The return value could be any non negative degree value from 0 to 360.

Returns:
float