Class Player

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

public class Player
extends java.lang.Thread

This class initializes communication, brain and worldmodel. Brain needs a reference to communication and worldmodel. Worldmodel nees a reference to communication

Author:
Patrick Ficher

Field Summary
private  Brain brain
          The brain of each player
private  Communication communication
          The communication of each player
private  PlayerAction playerAction
          The PlayerAction of each player
private  Worldmodel world
          The worldmodel of each player
 
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)
          Creates a new Player instance.
 
Method Summary
 double[] bodyDoubleArray()
          Should be called from the GUI
 double[][] giveWorldData()
          Should be called from the GUI.
 java.lang.String[] hearStringArray()
          Should be called from the GUI
 boolean playDirectionRight()
          Should be called from the GUI
 void run()
          Starts the brain
 
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

communication

private Communication communication
The communication of each player

brain

private Brain brain
The brain of each player

world

private Worldmodel world
The worldmodel of each player

playerAction

private PlayerAction playerAction
The PlayerAction of each player
Constructor Detail

Player

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

giveWorldData

public double[][] giveWorldData()
Should be called from the GUI.
Returns:
the double[][] positions array from the worldmodel.
See Also:
worldmodel.giveData()

playDirectionRight

public boolean playDirectionRight()
Should be called from the GUI
Returns:
the boolean playdirection form the worldmodel.
See Also:
worldmodel.playDirectionRight()

bodyDoubleArray

public double[] bodyDoubleArray()
Should be called from the GUI
Returns:
the double[] body arrray form the worldmodel.
See Also:
worldmodel.bodyDoubleArray()

hearStringArray

public java.lang.String[] hearStringArray()
Should be called from the GUI
Returns:
the String[] hear array form the worldmodel.
See Also:
worldmodel.hearStringArray()

run

public void run()
Starts the brain
Overrides:
run in class java.lang.Thread