Class Brain

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--Brain
All Implemented Interfaces:
java.lang.Runnable, SensorInput

class Brain
extends java.lang.Thread
implements SensorInput

Brain class. Used to receive and send command information from and to the server. In fully automated teams, this class is responsible for invoking the decision making process. However, for IAS, this decision making is left up to the individual human player.


Field Summary
 boolean m_hasMoved
           
 SendCommand m_IAS
           
 Memory m_memory
           
 boolean m_resetPosition
           
 char m_side
           
protected  boolean m_timeOver
           
 PlayerCanvas p_canvas
           
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritableThreadLocals, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadLocals, threadQ
 
Constructor Summary
Brain(SendCommand IAS, java.lang.String team, char side, int number, java.lang.String playMode)
          Brain constructor.
 
Method Summary
 void hear(int time, int direction, java.lang.String message)
          Hear method declared in the SensorInput interface.
 void hear(int time, java.lang.String message)
          Hear method declared in the SensorInput interface.
 void resetPlayerPosition()
          ResetPlayerPosition method.
 void run()
          Run method.
 void see(VisualInfo info)
          See method declared in the SensorInput interface.
 void sense(SenseBodyInfo info)
          Sense method declared in the SensorInput interface.
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_IAS

public SendCommand m_IAS

m_memory

public Memory m_memory

m_side

public char m_side

m_hasMoved

public boolean m_hasMoved

m_resetPosition

public boolean m_resetPosition

m_timeOver

protected volatile boolean m_timeOver

p_canvas

public PlayerCanvas p_canvas
Constructor Detail

Brain

public Brain(SendCommand IAS,
             java.lang.String team,
             char side,
             int number,
             java.lang.String playMode)
Brain constructor. This constructor is used to set default values for various variables, as well as starting the thread process.
Parameters:
IAS - The main IAS command interface
team - The teamname for which the IAS player is a member of
side - The side of the field which the IAS team is on - either 'l' or 'r'
number - The uniform number for the IAS player
playMode - The current play_mode of the game.
Method Detail

run

public void run()
Run method. This method is used to run the thread. It's purpose is to continuously run, obtaining command information from the server, until the game is over.
Overrides:
run in class java.lang.Thread
Returns:
none

see

public void see(VisualInfo info)
See method declared in the SensorInput interface. This method is used to store the see information received from the server.
Specified by:
see in interface SensorInput
Parameters:
info - The current visual information received from the server.
Returns:
none

sense

public void sense(SenseBodyInfo info)
Sense method declared in the SensorInput interface. This method is used to store the sense_body information received from the server.
Specified by:
sense in interface SensorInput
Parameters:
info - The current sense_body information received from the server.
Returns:
none

hear

public void hear(int time,
                 int direction,
                 java.lang.String message)
Hear method declared in the SensorInput interface. This method is used to store the hear information received from the server - not currently implemented.
Specified by:
hear in interface SensorInput
Parameters:
time - The cycle number of the game which the hear message was generated.
direction - The approximate angle direction that the message was received.
message - The actual message heard
Returns:
none

hear

public void hear(int time,
                 java.lang.String message)
Hear method declared in the SensorInput interface. This method is used to determine if the message received pertained to the stop of game play by the referee, thereby resetting the player's position.
Specified by:
hear in interface SensorInput
Parameters:
time - The cycle number of the game which the hear message was generated.
message - The actual message heard
Returns:
none

resetPlayerPosition

public void resetPlayerPosition()
ResetPlayerPosition method. This method is used to reset the player's position on the field - not currently implemented.
Returns:
none