appletbots.swarm
Class SwarmAgent
java.lang.Object
appletbots.WorldObject
appletbots.Agent
appletbots.swarm.SwarmAgent
public class SwarmAgent
- extends Agent
A swarm agent looks at its neighbors, chooses a certain number
of them, and accelerates in the direction of their average velocity,
with a part of its acceleration being randomized.
- Author:
- Erik Rasmussen
Constructor Summary |
SwarmAgent(int size,
int sight,
double maxSpeed,
double maxAcceleration,
int numNeighborsToFollow,
boolean chooseNeighborsByProximity,
double randomizationFactor)
Constructs a swarm agent with the given parameters |
Method Summary |
void |
observeWorld()
Observes the world, and follows the Swarm 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 |
SwarmAgent
public SwarmAgent(int size,
int sight,
double maxSpeed,
double maxAcceleration,
int numNeighborsToFollow,
boolean chooseNeighborsByProximity,
double randomizationFactor)
- Constructs a swarm 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 agentnumNeighborsToFollow
- The number of neightbors to followchooseNeighborsByProximity
- How to choose neighbors to followrandomizationFactor
- The percentage of acceleration to be random
observeWorld
public void observeWorld()
- Observes the world, and follows the Swarm Agent Algorithm.
- Specified by:
observeWorld
in class Agent