appletbots.spreadout
Class SpreadOutAgent

java.lang.Object
  extended by appletbots.WorldObject
      extended by appletbots.Agent
          extended by appletbots.spreadout.SpreadOutAgent

public class SpreadOutAgent
extends Agent

A spread-out agent looks at its neighbors, and accelerates to a position to maximize the distance to his neighbors.

Author:
Erik Rasmussen

Field Summary
 
Fields inherited from class appletbots.Agent
accelerationVectorColor, maxAcceleration, sight, velocityVectorColor, world
 
Fields inherited from class appletbots.WorldObject
color, mass, maxSpeed, size
 
Constructor Summary
SpreadOutAgent(int size, int sight, double maxSpeed, double maxAcceleration, double accelerationFactor, boolean stopWhenNoNeighbors)
          Constructs a spread-out agent with the given parameters
 
Method Summary
 void observeWorld()
          Observes the world, and follows the Spread-Out Agent Algorithm.
 
Methods inherited from class appletbots.Agent
getAcceleration, getMaxAcceleration, getRandomAcceleration, getShowAcceleration, getShowVelocity, getSight, getVectorsToDraw, setAcceleration, setShowAcceleration, setShowVelocity, setWorld
 
Methods inherited from class appletbots.WorldObject
collidedWith, getColor, getMass, getMaxSpeed, getSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpreadOutAgent

public SpreadOutAgent(int size,
                      int sight,
                      double maxSpeed,
                      double maxAcceleration,
                      double accelerationFactor,
                      boolean stopWhenNoNeighbors)
Constructs a spread-out agent with the given parameters

Parameters:
size - The agent's radius
sight - The distance the agent can see
maxSpeed - The maximum speed the agent can travel
maxAcceleration - The maximum acceleration for this agent
accelerationFactor - Percentage of desired location to accelerate
stopWhenNoNeighbors - Whether or not to stop when there are no visible neighbors
Method Detail

observeWorld

public void observeWorld()
Observes the world, and follows the Spread-Out Agent Algorithm.

Specified by:
observeWorld in class Agent