EDU.gatech.cc.is.simulation
Class GolfBallSim

java.lang.Object
  |
  +--EDU.gatech.cc.is.simulation.AttractorSim
        |
        +--EDU.gatech.cc.is.simulation.GolfBallSim
Direct Known Subclasses:
GolfBallNoiseSim

public class GolfBallSim
extends AttractorSim
implements SimulatedObject, SocRef

A golfball for RoboCup Soccer. Introduction
GolfBallSim implements a golf ball for RoboCup soccer simulations. The ball is also the scorekeeper and the referee; after all who would know better whether a scoring event occured?

A "shot clock" keeps track of how long since a scoring event occured. If it times-out, the ball is reset to the center of the field.

Copyright (c)2000 Tucker Balch


Field Summary
static boolean DEBUG
           
protected  Vec2 velocity
           
 
Fields inherited from class EDU.gatech.cc.is.simulation.AttractorSim
all_objects, background, bottom, DEBUG, deposited, foreground, left, picked_up, position, RADIUS, rando, right, seed, top, unique_id, visionclass
 
Constructor Summary
GolfBallSim()
          Instantiate a golf ball.
 
Method Summary
 void draw(java.awt.Graphics g, int w, int h, double t, double b, double l, double r)
          Draw the golf ball and display score and shotclock.
 boolean eastJustScored()
          True if it is east just scored.
 boolean eastKickOff()
          True if it is east's turn to kick off.
 boolean playBall()
          True if the game is underway.
 void push(Vec2 d, Vec2 v)
          Handle a push.
 void takeStep(long time_increment, SimulatedObject[] all_objs)
          Take a simulated step;
 boolean westJustScored()
          True if it is west just scored.
 boolean westKickOff()
          True if it is west's turn to kick off.
 
Methods inherited from class EDU.gatech.cc.is.simulation.AttractorSim
checkCollision, checkCollision, clearTrail, draw, drawIcon, drawID, drawState, drawTrail, getCenter, getClosestPoint, getID, getPosition, getVisionClass, init, isObstacle, isPickupable, isPushable, pickUp, putDown, quit, receive, setID, setTrailLength, setVisionClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

velocity

protected Vec2 velocity

DEBUG

public static final boolean DEBUG
Constructor Detail

GolfBallSim

public GolfBallSim()
Instantiate a golf ball.
Method Detail

takeStep

public void takeStep(long time_increment,
                     SimulatedObject[] all_objs)
Take a simulated step;
Specified by:
takeStep in interface SimulatedObject
Overrides:
takeStep in class AttractorSim
Tags copied from interface: SimulatedObject
Parameters:
time_increment - how much time has elapsed since the last call.
all_objects - the other objects in the simulation.

push

public void push(Vec2 d,
                 Vec2 v)
Handle a push. This is how to kick or push the ball.
Specified by:
push in interface SimulatedObject
Overrides:
push in class AttractorSim
Tags copied from interface: SimulatedObject
Parameters:
d - the direction and distance of the push.
v - the velocity of the push.

draw

public void draw(java.awt.Graphics g,
                 int w,
                 int h,
                 double t,
                 double b,
                 double l,
                 double r)
Draw the golf ball and display score and shotclock.
Specified by:
draw in interface SimulatedObject
Overrides:
draw in class AttractorSim
Tags copied from interface: SimulatedObject
Parameters:
g - graphics area to draw the object.
w - the width in pixels of g.
h - the height in pixels of g.
t - the y coordinate represented by the top boundary of the drawing area.
b - the y coordinate represented by the bottom boundary of the drawing area.
l - the x coordinate represented by the left boundary of the drawing area.
r - the x coordinate represented by the right boundary of the drawing area.

playBall

public boolean playBall()
True if the game is underway. If false, the soccer robots should reset their positions on the field according to whether they kick off or not.
Specified by:
playBall in interface SocRef
Returns:
true if game is underway.

eastKickOff

public boolean eastKickOff()
True if it is east's turn to kick off.
Specified by:
eastKickOff in interface SocRef
Returns:
true if it is east's turn to kick off.

westKickOff

public boolean westKickOff()
True if it is west's turn to kick off. This occurs at the begining of the game, and after east scores.
Specified by:
westKickOff in interface SocRef
Returns:
true if it is west's turn to kick off.

westJustScored

public boolean westJustScored()
True if it is west just scored.
Specified by:
westJustScored in interface SocRef
Returns:
true if west just scored.

eastJustScored

public boolean eastJustScored()
True if it is east just scored.
Specified by:
eastJustScored in interface SocRef
Returns:
true if east just scored.