Class Player

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--Player
All Implemented Interfaces:
java.lang.Runnable

public class Player
extends java.lang.Thread

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

So one limitation is, that the client only can play from left to right

Version:
1.1
Author:
Gerald Kuehne, Markus Beier

Field Summary
private  Actor actor
          the actor module of the client
private  int PLAYING
          constant defining the PLAYING status
private  int START
          constant defining the START status
private  int status
          current status the player is in; can be START or PLAYING
private  java.lang.String teamName
          the name of the team (for initialization)
private  ObjectPerception theBall
          the current information regarding the ball
private  ObjectPerception theGoal
          the current information regarding the goal
private  int time
          the actual timestamp of last visual event received
 
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
Player(java.lang.String servername, int serverport, java.lang.String teamName)
          Creates a new Player instance.
 
Method Summary
static void main(java.lang.String[] args)
          Starts the client
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

actor

private Actor actor
the actor module of the client

teamName

private 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
See Also:
START, PLAYING

theBall

private ObjectPerception theBall
the current information regarding the ball

theGoal

private ObjectPerception theGoal
the current information regarding the goal

time

private int time
the actual timestamp of last visual event received
Constructor Detail

Player

public Player(java.lang.String servername,
              int serverport,
              java.lang.String teamName)
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
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

main

public static void main(java.lang.String[] args)
Starts the client
Parameters:
args - The arguments passed must specify SERVERNAME PORT TEAMNAME in this order.