simulator.model
Interface ISimulatorTeam

All Known Implementing Classes:
SCORETeam

public interface ISimulatorTeam

The interface of a simulator as seen by a Team. Note that deviations from the pre-conditions/parameter constraints specified for each method will result in a protocol error and therefore ending of the game.

Version:
1.0
Author:
pouria

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.
 

Method Detail

connect

boolean connect(java.lang.String host,
                Student sim,
                Student team)
Connect to host using Soccer2006 protocol.

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

Reply initGame(Side prefSide)
               throws ParseException,
                      java.io.IOException
Protocol sequence to initialize game.

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

getGameData

Reply getGameData()
                  throws java.io.IOException,
                         ParseException
Send all feedback request.

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

spin

Reply spin(int t,
           int p,
           double av)
           throws java.io.IOException,
                  ParseException
Send spin control request. Sets angular velocity for the player

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

Reply accelerate(int t,
                 int p,
                 double a)
                 throws java.io.IOException,
                        ParseException
Send accelerate control request. Sets the acceleration for the player

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

Reply kick(int t,
           int p,
           double v,
           double alpha)
           throws java.io.IOException,
                  ParseException
Send kick control request. Attempt to kick the ball.

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

Reply end()
          throws java.io.IOException,
                 ParseException
Instruct simulator to abort the game. Normally only in the case of protocol error.

Returns:
EndReply
Throws:
java.io.IOException - connection/network error
ParseException - incorrectly formatted message.

quit

Reply quit()
           throws java.io.IOException,
                  ParseException
Instruct the simulator to disconnect and shut down.

Returns:
normally QuitReply
Throws:
java.io.IOException - connection/network error
ParseException - incorrectly formatted message.

place_player

Reply place_player(int t,
                   int p,
                   CartesianVect l)
                   throws java.io.IOException,
                          ParseException
Send place_player control request. Sets the position for the player

Precondition: Simulator is in Test mode.

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

Reply place_ball(int t,
                 CartesianVect l)
                 throws java.io.IOException,
                        ParseException
Send place_ball control request. Sets the position for the ball

Precondition: Simulator is in Test mode.

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

Reply set_time(int t,
               int newT)
               throws java.io.IOException,
                      ParseException
Send set_time control request. Sets the game time

Precondition: Simulator is in Test mode.

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.