appletbots.directedballs
Class DirectedKicker

java.lang.Object
  extended by appletbots.WorldObject
      extended by appletbots.Agent
          extended by appletbots.balls.Kicker
              extended by appletbots.directedballs.DirectedKicker

public class DirectedKicker
extends Kicker

A directed kicker agent chooses a visible ball at random and tries to "kick" it so that the ball will move in the the bot's goal direction. The agent calculates the spot on the ball it needs to hit to knock the ball in the right direction. If it senses that moving directly towards the target spot will result in kicking the ball in another direction, the agent accelerates around the bot (orthagonal to the vector towards the target spot) until it can hit the target spot.

Author:
Erik Rasmussen

Field Summary
protected  Vector direction
          The goal direction
 
Fields inherited from class appletbots.Agent
accelerationVectorColor, maxAcceleration, sight, velocityVectorColor, world
 
Fields inherited from class appletbots.WorldObject
color, mass, maxSpeed, size
 
Constructor Summary
DirectedKicker(Vector direction, java.awt.Color color, int size, int sight, double maxSpeed, double maxAcceleration)
          Constructs a new DirectedKicker with the given parameters
 
Method Summary
 void observeWorld()
          Observes the world, and follows the Directed Kicker Algorithm.
 
Methods inherited from class appletbots.balls.Kicker
chooseBall
 
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
 

Field Detail

direction

protected Vector direction
The goal direction

Constructor Detail

DirectedKicker

public DirectedKicker(Vector direction,
                      java.awt.Color color,
                      int size,
                      int sight,
                      double maxSpeed,
                      double maxAcceleration)
Constructs a new DirectedKicker with the given parameters

Parameters:
direction - The agent's goal direction
color - The agent's color
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 Directed Kicker Algorithm.

Overrides:
observeWorld in class Kicker