game.net
Class SCORETeam

java.lang.Object
  extended by game.net.SCORETeam
All Implemented Interfaces:
ISimulatorTeam

public class SCORETeam
extends java.lang.Object
implements ISimulatorTeam

Version:
$Revision: 385 $ $Date: 2008-03-11 10:10:33 -0230 (Tue, 11 Mar 2008) $

Constructor Summary
SCORETeam()
           
 
Method Summary
 Reply accelerate(int t, int p, double a)
          Send accelerate control request.
 boolean connect(java.lang.String host, Student sim, Student team)
          Connect to host using Soccer2006 protocol.
 Reply end()
          Instruct simulator to abort the game.
 Reply getGameData()
          Send all feedback request.
 Reply initGame(Side prefSide)
          Protocol sequence to initialize game.
 Reply kick(int t, int p, double v, double alpha)
          Send kick control request.
 Reply place_ball(int t, CartesianVect l)
          Send place_ball control request.
 Reply place_player(int t, int p, CartesianVect l)
          Send place_player control request.
 Reply quit()
          Instruct the simulator to disconnect and shut down.
 Reply set_time(int t, int newT)
          Send set_time control request.
 Reply spin(int t, int p, double av)
          Send spin control request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SCORETeam

public SCORETeam()
Method Detail

connect

public boolean connect(java.lang.String host,
                       Student sim,
                       Student team)
Description copied from interface: ISimulatorTeam
Connect to host using Soccer2006 protocol.

Specified by:
connect in interface ISimulatorTeam
Parameters:
host - hostname or ipaddress for simulator
sim - which simulator model will host the game
team - which team am I
Returns:
true if connection was successful, false otherwise

initGame

public Reply initGame(Side prefSide)
               throws ParseException,
                      java.io.IOException
Description copied from interface: ISimulatorTeam
Protocol sequence to initialize game.

Specified by:
initGame in interface ISimulatorTeam
Parameters:
prefSide - the preferred side for this team.
Returns:
OnSideReply or QuitReply.
Throws:
ParseException - incorrectly formatted message.
java.io.IOException - connection/network error

getGameData

public Reply getGameData()
                  throws java.io.IOException,
                         ParseException
Description copied from interface: ISimulatorTeam
Send all feedback request.

Specified by:
getGameData in interface ISimulatorTeam
Returns:
normally AllReply. GoalReply, ResetReply and EndReply are also possible.
Throws:
java.io.IOException - connection/network error
ParseException - incorrectly formatted message.

spin

public Reply spin(int t,
                  int p,
                  double av)
           throws java.io.IOException,
                  ParseException
Description copied from interface: ISimulatorTeam
Send spin control request. Sets angular velocity for the player

Specified by:
spin in interface ISimulatorTeam
Parameters:
t - Time at which this command is to be executed. 0 <= t
p - Player number. In {0, 1, 2, 3, 4}
av - Angular velocity in degrees per second. -90 <= av <= 90
Returns:
normally ControlReply. GoalReply, ResetReply and EndReply are also possible.
Throws:
java.io.IOException - connection/network error
ParseException - incorrectly formatted message.

accelerate

public Reply accelerate(int t,
                        int p,
                        double a)
                 throws java.io.IOException,
                        ParseException
Description copied from interface: ISimulatorTeam
Send accelerate control request. Sets the acceleration for the player

Specified by:
accelerate in interface ISimulatorTeam
Parameters:
t - Time at which this command is to be executed. 0 <= t
p - Player number. In {0, 1, 2, 3, 4}
a - rate of acceleration. -5 <= a <= 1
Returns:
normally ControlReply. GoalReply, ResetReply and EndReply are also possible.
Throws:
java.io.IOException - connection/network error
ParseException - incorrectly formatted message.

kick

public Reply kick(int t,
                  int p,
                  double v,
                  double alpha)
           throws java.io.IOException,
                  ParseException
Description copied from interface: ISimulatorTeam
Send kick control request. Attempt to kick the ball.

Specified by:
kick in interface ISimulatorTeam
Parameters:
t - Time at which this command is to be executed. 0 <= t
p - Player number. In {0, 1, 2, 3, 4}
v - Change in the ball's velocity. 0 <= v <= 10
alpha - Offset in degrees from a line connecting the player's centre to the ball's centre. -45 <= alpha <= 45
Returns:
normally ControlReply. GoalReply, ResetReply and EndReply are also possible.
Throws:
java.io.IOException - connection/network error
ParseException - incorrectly formatted message.

end

public Reply end()
          throws java.io.IOException,
                 ParseException
Description copied from interface: ISimulatorTeam
Instruct simulator to abort the game. Normally only in the case of protocol error.

Specified by:
end in interface ISimulatorTeam
Returns:
EndReply
Throws:
java.io.IOException - connection/network error
ParseException - incorrectly formatted message.

quit

public Reply quit()
           throws java.io.IOException,
                  ParseException
Description copied from interface: ISimulatorTeam
Instruct the simulator to disconnect and shut down.

Specified by:
quit in interface ISimulatorTeam
Returns:
normally QuitReply
Throws:
java.io.IOException - connection/network error
ParseException - incorrectly formatted message.

place_player

public Reply place_player(int t,
                          int p,
                          CartesianVect l)
                   throws java.io.IOException,
                          ParseException
Description copied from interface: ISimulatorTeam
Send place_player control request. Sets the position for the player

Precondition: Simulator is in Test mode.

Specified by:
place_player in interface ISimulatorTeam
Parameters:
t - Time at which this command is to be executed. 0 <= t
p - Player number. In {0, 1, 2, 3, 4}
l - New position for player
Returns:
normally ControlReply. GoalReply, ResetReply and EndReply are also possible.
Throws:
java.io.IOException - connection/network error
ParseException - incorrectly formatted message.

place_ball

public Reply place_ball(int t,
                        CartesianVect l)
                 throws java.io.IOException,
                        ParseException
Description copied from interface: ISimulatorTeam
Send place_ball control request. Sets the position for the ball

Precondition: Simulator is in Test mode.

Specified by:
place_ball in interface ISimulatorTeam
Parameters:
t - Time at which this command is to be executed. 0 <= t
l - New position for ball
Returns:
normally ControlReply. GoalReply, ResetReply and EndReply are also possible.
Throws:
java.io.IOException - connection/network error
ParseException - incorrectly formatted message.

set_time

public Reply set_time(int t,
                      int newT)
               throws java.io.IOException,
                      ParseException
Description copied from interface: ISimulatorTeam
Send set_time control request. Sets the game time

Precondition: Simulator is in Test mode.

Specified by:
set_time in interface ISimulatorTeam
Parameters:
t - Time at which this command is to be executed. 0 <= t
newT - New time
Returns:
normally ControlReply. GoalReply, ResetReply and EndReply are also possible.
Throws:
java.io.IOException - connection/network error
ParseException - incorrectly formatted message.