Class Player

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--Player
All Implemented Interfaces:
DebugInterface, PlayModeInterface, java.lang.Runnable, StrategyGeneralInterface

public class Player
extends java.lang.Thread
implements DebugInterface, PlayModeInterface, StrategyGeneralInterface

This is the central class of the client. Here, all visual information is evaluated and converted into decisions resp. actions

Version:
1.00
Author:
Daniel Förderer, Moritz Steiner, Michael Schifferdecker, Samuel Broscheit

Field Summary
 Actor actor
          the actor module of the client
 AgentInfo agentInfo
          database for all infos about one player
private  boolean DEBUG
          class internal debug switch
private  boolean hasTurned
           
 boolean isGoalie
          the the goalie flag of the player
private  int PLAYING
          constant defining the PLAYING status
 SkillManager skillManager
          the skill manager of the player
private  int START
          constant defining the START status
private  int status
          current status the player is in; can be START or PLAYING
 StrategyManager strategyManager
          the strategy manager of the player
 TacticsManager tacticsManager
          the tactics manager of the player
static java.lang.String teamName
          the name of the team (for initialization)
private  int time
          the actual timestamp of last visual event received
private static boolean visualize
          is visualisation enabled?
(package private) static visWindow vW
          visualization window
 
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
 
Fields inherited from interface DebugInterface
DEBUG_SWITCH_STRATEGY_IS_SET, DEBUG_SWITCH_VISUALISATION_IS_SET, DEBUG_SWITCH_WORLDMODEL_AUDIOEVENT_IS_SET, DEBUG_SWITCH_WORLDMODEL_BODYEVENT_IS_SET, DEBUG_SWITCH_WORLDMODEL_VISUALEVENT_IS_SET
 
Fields inherited from interface PlayModeInterface
PLAYMODE_BEFORE_KICK_OFF, PLAYMODE_EXTEND, PLAYMODE_HALF_TIME, PLAYMODE_OPPONENTS_CORNER_KICK, PLAYMODE_OPPONENTS_FOUL, PLAYMODE_OPPONENTS_FREE_KICK, PLAYMODE_OPPONENTS_GOAL, PLAYMODE_OPPONENTS_GOAL_KICK, PLAYMODE_OPPONENTS_GOALIE_CATCH, PLAYMODE_OPPONENTS_KICK_IN, PLAYMODE_OPPONENTS_KICK_OFF, PLAYMODE_OPPONENTS_OFFSIDE, PLAYMODE_OUR_CORNER_KICK, PLAYMODE_OUR_FOUL, PLAYMODE_OUR_FREE_KICK, PLAYMODE_OUR_GOAL, PLAYMODE_OUR_GOAL_KICK, PLAYMODE_OUR_GOALIE_CATCH, PLAYMODE_OUR_KICK_IN, PLAYMODE_OUR_KICK_OFF, PLAYMODE_OUR_OFFSIDE, PLAYMODE_PLAY_ON, PLAYMODE_TIME_UP, PLAYMODES
 
Fields inherited from interface StrategyGeneralInterface
AUDIO_CUT_DIST, BALL_DECAY, BALL_RAND, BALL_SIZE, BALL_SPEED_MAX, BALL_WEIGHT, CATCH_BAN_CYCLE, CATCH_PROBABILITY, CATCHABLE_AREA_L, CATCHABLE_AREA_W, CKICK_MARGIN, DASH_POWER_RATE, EFFORT_DEC, EFFORT_DEC_THR, EFFORT_INC, EFFORT_INC_THR, EFFORT_MIN, FORMATION_244, FORMATION_433, FORMATION_541, FORMATION_CATENAGIO, FORMATIONS_NUM_OF, GOAL_CENTER_POINT, GOAL_WIDTH, HEAR_DECAY, HEAR_INC, HEAR_MAX, INERTIA_MOMENT, KICK_POWER_RATE, KICKABLE_AREA, KICKABLE_MARGIN, MAX_AUDIOINFO, MAX_DASH_PER_CYCLE, MAXMOMENT, MAXPOWER, MIN_STAMINA, MINMOMENT, MINPOWER, NECK, OFFSIDE_ACTIVE_AREA_SIZE, PENALTY_AREA_X_WIDTH, PENALTY_AREA_Y_WIDTH, PLAYER_DECAY, PLAYER_RAND, PLAYER_SIZE, PLAYER_SPEED_MAX, PLAYER_WEIGHT, PORT, RECOVER_DEC, RECOVER_DEC_THR, RECOVER_MIN, RECV_STEP, SEND_STEP, SENSE_BODY_STEP, SIMULATOR_STEP, SKILL_CENTER_EGDE_OF_VIEW, SKILL_CONST_SLOPE, SKILL_DEC_SLOPE, SKILL_DESTINATION_DASH, SKILL_DISTANCE_DASH, SKILL_DYNOBJ_DASH, SKILL_DYNOBJ_SHOOT, SKILL_FIX_ANGLE_TURN, SKILL_FIX_ANGLE_TURN_NECK, SKILL_HIGH_PRECISION, SKILL_INC_SLOPE, SKILL_INFINIT, SKILL_KOORD_SHOOT, SKILL_LEFT_EGDE_OF_VIEW, SKILL_LOW_PRECISION, SKILL_MEDIUM_PRECISION, SKILL_RIGHT_EGDE_OF_VIEW, SKILL_TO_COORDINATES_TURN, SKILL_TO_COORDINATES_TURN_NECK, SKILL_TO_DYNOBJ_TURN, STAMINA_INC_MAX, STAMINA_MAX, STRATEGIES, STRATEGY_FLAG_OPPGOAL, STRATEGY_FLAG_PUMP, STRATEGY_FLAG_TESTFLAG, VISIBLE_ANGLE
 
Constructor Summary
Player(java.lang.String servername, int serverport, java.lang.String teamName, boolean isGoalie, boolean visualize, visWindow vW)
          Creates a new Player instance.
 
Method Summary
 void bye()
          removes the player from the field by calling actor.bye()
(package private)  void debug(java.lang.String dbgMsg)
           
private  void play()
          Processes the information gained and transforms it into a decision/action.
 void run()
          This method overwrites run() from Thread.
 
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

isGoalie

public boolean isGoalie
the the goalie flag of the player

actor

public Actor actor
the actor module of the client

agentInfo

public AgentInfo agentInfo
database for all infos about one player

strategyManager

public StrategyManager strategyManager
the strategy manager of the player

tacticsManager

public TacticsManager tacticsManager
the tactics manager of the player

skillManager

public SkillManager skillManager
the skill manager of the player

teamName

public static java.lang.String teamName
the name of the team (for initialization)

START

private final int START
constant defining the START status

PLAYING

private final int PLAYING
constant defining the PLAYING status

status

private int status
current status the player is in; can be START or PLAYING

time

private int time
the actual timestamp of last visual event received

DEBUG

private boolean DEBUG
class internal debug switch

hasTurned

private boolean hasTurned

vW

static visWindow vW
visualization window

visualize

private static boolean visualize
is visualisation enabled?
Constructor Detail

Player

public Player(java.lang.String servername,
              int serverport,
              java.lang.String teamName,
              boolean isGoalie,
              boolean visualize,
              visWindow vW)
Creates a new Player instance.
Parameters:
servername - a String value specifying the name of the server
serverport - an int value specifying the port on which the server listens for incoming packets
teamName - a String value is the name of the team you want to join/create
isGoalie - switch for goalie (only one player)
visualize - switch to enable visualisation
vW - pointer to visualisation window
Method Detail

run

public void run()
This method overwrites run() from Thread. It is executed when start() is called for the Player Thread
Overrides:
run in class java.lang.Thread

play

private void play()
Processes the information gained and transforms it into a decision/action. It should only be called once per 100ms period, so its proper execution on the server is assured.
NOTE: "Big" commands like the "dash"-command consume 100ms while "small" commands like the one to turn the neck of the player consume less time. So it might be possible to send more commands. As we use only the longer ones this fact is irrelevant for our client, but might be an issue in the development of more sophisticated movements

bye

public void bye()
removes the player from the field by calling actor.bye()

debug

void debug(java.lang.String dbgMsg)