appletbots.spreadout
Class SpreadOutAgent
java.lang.Object
appletbots.WorldObject
appletbots.Agent
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
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 radiussight
- The distance the agent can seemaxSpeed
- The maximum speed the agent can travelmaxAcceleration
- The maximum acceleration for this agentaccelerationFactor
- Percentage of desired location to acceleratestopWhenNoNeighbors
- Whether or not to stop when there are no visible neighbors
observeWorld
public void observeWorld()
- Observes the world, and follows the Spread-Out Agent Algorithm.
- Specified by:
observeWorld
in class Agent