appletbots.balls
Class Kicker

java.lang.Object
  extended by appletbots.WorldObject
      extended by appletbots.Agent
          extended by appletbots.balls.Kicker
Direct Known Subclasses:
DirectedKicker

public class Kicker
extends Agent

A kicker agent chooses a visible ball at random and accelerates towards it. If no ball is visible the agent sets his acceleration to zero.

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
Kicker(int size, int sight, double maxSpeed, double maxAcceleration)
          Constructs a new Kicker with the given parameters
 
Method Summary
protected  Ball chooseBall()
          Selects a ball at random from those visible
 void observeWorld()
          Observes the world, and follows the Kicker 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

Kicker

public Kicker(int size,
              int sight,
              double maxSpeed,
              double maxAcceleration)
Constructs a new Kicker 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
Method Detail

observeWorld

public void observeWorld()
Observes the world, and follows the Kicker Algorithm.

Specified by:
observeWorld in class Agent

chooseBall

protected Ball chooseBall()
Selects a ball at random from those visible

Returns:
The chosen ball