betir
Class RobocupBehavior

java.lang.Object
  |
  +--betir.RobocupBehavior
Direct Known Subclasses:
CornerKickBehavior, GoalieReturnToZoneBehavior, GoalieUpDownBehavior, KiddySoccerBehavior, PassBehavior, ReturnToZoneBehavior, ShootGoalBehavior, StartBehavior, StayPutBehavior, TauntBehavior

public abstract class RobocupBehavior
extends java.lang.Object

This is the main behavior class.


Field Summary
protected  boolean m_bLastWasTurn
           
 
Constructor Summary
RobocupBehavior(RobocupEnvironment env, DatagramWrapper dg)
           
 
Method Summary
 int angleToAngle(int nAngle)
           
 int angleToPoint(int nX, int nY)
           
abstract  boolean canFire()
          Determines if a behavior can fire or not
 void catchBall(int direction)
          Sends a catch command to the server
 void changeView(java.lang.String strWidth, java.lang.String strQuality)
           
 void dash(float fPower)
          Sends a dash command to the server
 void dashToBall()
          Dashes to the ball.
 void dashToPoint(int nX, int nY)
           
protected  TwoDVec findInterceptBall(int nAngle)
           
abstract  boolean fire()
          Execute the behavior
 int getZoneDist()
           
abstract  boolean inhibits(RobocupBehavior rb)
          Determines if this behavior inhibits another behavior
 void kick(float fPower, int nAngle)
          Sends a kick message to the soccer server
 void move(int nX, int nY)
          Sends a move message to the soccer server
 void say(java.lang.String str)
          Sends a say command to the server
 void turn(int nAngle)
          Sends a turn command to the server
 void turnHead(int nAngle)
          Sends a turn_neck command to the server
static boolean withinRange(int nNum, int nCenter, int nRange)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_bLastWasTurn

protected boolean m_bLastWasTurn
Constructor Detail

RobocupBehavior

public RobocupBehavior(RobocupEnvironment env,
                       DatagramWrapper dg)
Method Detail

canFire

public abstract boolean canFire()
Determines if a behavior can fire or not

inhibits

public abstract boolean inhibits(RobocupBehavior rb)
Determines if this behavior inhibits another behavior
Parameters:
rb - the behavior to be checked

fire

public abstract boolean fire()
Execute the behavior

move

public void move(int nX,
                 int nY)
Sends a move message to the soccer server
Parameters:
nX - the x-corrdinate
nY - the y-corrdinate

dash

public void dash(float fPower)
Sends a dash command to the server
Parameters:
fPower - the power to dash

kick

public void kick(float fPower,
                 int nAngle)
Sends a kick message to the soccer server
Parameters:
fPower - the power to kick
nAngle - the angle to kick

turn

public void turn(int nAngle)
Sends a turn command to the server
Parameters:
nAngle - the angle to turn your body

turnHead

public void turnHead(int nAngle)
Sends a turn_neck command to the server
Parameters:
nAngle - the angle to turn

say

public void say(java.lang.String str)
Sends a say command to the server
Parameters:
str - the message to say

catchBall

public void catchBall(int direction)
Sends a catch command to the server
Parameters:
direction - the direction to catch the ball

changeView

public void changeView(java.lang.String strWidth,
                       java.lang.String strQuality)

getZoneDist

public int getZoneDist()
Returns:
int a players distance from his zone

angleToPoint

public int angleToPoint(int nX,
                        int nY)
Parameters:
nX - x-coordinate
nY - y-coordinate
Returns:
int the angle from the player to the specified point

angleToAngle

public int angleToAngle(int nAngle)
Parameters:
nAngle -  
Returns:
int the angle from the player to a specified angle

withinRange

public static boolean withinRange(int nNum,
                                  int nCenter,
                                  int nRange)
Parameters:
nNum - the number to check
nCenter - the center of the check
nRange - the specified range
Returns:
boolean

dashToPoint

public void dashToPoint(int nX,
                        int nY)
Parameters:
nX - the x-coordinate to dash to
nY - the y-coordinate to dash to
nMaxPower - the maximium power of the dash

dashToBall

public void dashToBall()
Dashes to the ball. This function uses prediction to attempt to optimize the interception of the ball.

findInterceptBall

protected TwoDVec findInterceptBall(int nAngle)
Parameters:
nAngle -  
Returns:
TwoDVec the predicted position of the ball