edu.udo.cs.ie.cowbots.internalActions.scout
Class distanceToCP

Package class diagram package distanceToCP
java.lang.Object
  extended by DefaultInternalAction
      extended by edu.udo.cs.ie.cowbots.internalActions.scout.distanceToCP

public class distanceToCP
extends DefaultInternalAction

Class for calculating the distance of the Agent to the checkpoint


Constructor Summary
distanceToCP()
           
 
Method Summary
private  int calculateDistance(int myX, int myY, int destX, int destY)
          Utility function for calculating the distance between Agent and checkpoint
 java.lang.Object execute(TransitionSystem ts, Unifier un, Term[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

distanceToCP

public distanceToCP()
Method Detail

execute

public java.lang.Object execute(TransitionSystem ts,
                                Unifier un,
                                Term[] args)
                         throws java.lang.Exception
Throws:
java.lang.Exception

calculateDistance

private int calculateDistance(int myX,
                              int myY,
                              int destX,
                              int destY)
Utility function for calculating the distance between Agent and checkpoint

Parameters:
myX - X-coordinate of the Agent
myY - Y-coordinate of the Agent
destX - X-coordinate of the CP
destY - Y-coordinate of the CP
Returns:
the distance