edu.sc.ants
Class GoodAgent

java.lang.Object
  |
  +--edu.sc.ants.Thing
        |
        +--edu.sc.ants.Agent
              |
              +--edu.sc.ants.GoodAgent

public class GoodAgent
extends Agent

An example agent that follows enemy (type = "bad") agents


Fields inherited from class edu.sc.ants.Thing
env, fixed, heading, lastInput, myBroadcastRange, myColor, myExpireWait, myID, mySensingRange, mySize, name, running, suspended, type, xLocation, yLocation
 
Constructor Summary
GoodAgent(int id, Environment e, java.lang.String n, double x, double y, double h, java.lang.String t)
           
 
Method Summary
 void draw(java.awt.Graphics g, double x, double y, double heading)
           
 Action generateAction()
          Find the enemy that is closest to us and head towards him, moving closer if we are in the correct heading.
 
Methods inherited from class edu.sc.ants.Agent
drawInfo, processInput
 
Methods inherited from class edu.sc.ants.Thing
draw, expireObservations, incorporateObservations, incorporateOthersObservations, resume, run, start, stop, suspend
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

GoodAgent

public GoodAgent(int id,
                 Environment e,
                 java.lang.String n,
                 double x,
                 double y,
                 double h,
                 java.lang.String t)
Method Detail

draw

public void draw(java.awt.Graphics g,
                 double x,
                 double y,
                 double heading)
Overrides:
draw in class Thing

generateAction

public Action generateAction()
Find the enemy that is closest to us and head towards him, moving closer if we are in the correct heading. If there are no enemies visible just move around randomly.
Overrides:
generateAction in class Agent