|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--soccerclient.brain.Player
Player This class implements basic methods and attributes of a Player
Field Summary | |
(package private) Action |
action
|
(package private) Communication |
com
|
(package private) Field |
field
|
(package private) Log |
log
|
(package private) Manager |
manager
|
(package private) int |
nr
|
(package private) java.io.PrintWriter |
out
|
(package private) PlayerInfo |
pi
|
(package private) PlayMode |
playmode
|
(package private) java.lang.String |
serverName
|
(package private) int |
serverPort
|
(package private) Coordinate |
standardPos
|
(package private) Coordinate |
startPos
|
(package private) StateDef |
state
|
(package private) java.lang.String |
teamName
|
(package private) ViewMode |
viewmode
|
Fields inherited from class java.lang.Thread |
inheritableThreadLocals, MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY, threadLocals |
Constructor Summary | |
Player(java.lang.String serverName,
int serverPort,
java.lang.String teamName,
boolean goalie)
creates a new Player instance |
Method Summary | |
(package private) void |
checkIn()
pseudo "constructor", executed after Communication has connected to server |
(package private) void |
directGoalKick()
kicks the ball with an direct kick towards the goal coordinate. |
(package private) void |
directKick(Coordinate coor,
double power)
kicks the ball without regard of the ball´s position to the player in the given direction |
(package private) void |
exactGoalKick()
kicks the ball with an exact kick towards the goal coordinate. |
(package private) void |
exactKick(Coordinate aPos,
double power)
kicks the ball to a Coordinate , after slightly kicking the ball to a
suitable position |
(package private) Coordinate |
getBall()
|
(package private) double |
getBallDir()
|
(package private) double |
getBallDist()
distance to the ball from PlayerInfo |
(package private) double |
getDirDist(Coordinate objCoordinate)
difference of directions between an object and body direction |
(package private) double |
getDist(Coordinate c1,
Coordinate c2)
distance between two objects |
(package private) OtherPlayer |
getFarestFriend()
selects the farest teammember from the list of near teammembers, whose uniform number is known |
(package private) Coordinate |
getFutureBall()
|
(package private) OtherPlayer |
getNearestEnemy()
selects the nearest enemy player from the list of near enemies, whose uniform number is known |
(package private) OtherPlayer |
getNearestFriend()
selects the nearest friendly player from the list of near teammembers, whose uniform number is known |
(package private) double |
getNormedDirection(double direction)
norm direction |
(package private) void |
goToBall(boolean stateCheck)
lets the player run to the resting ball on the shortest way |
(package private) void |
goToFastBall(boolean stateCheck)
lets the player run to the futur ball position on the shortest way during Play Mode play_on |
(package private) void |
goToFastBall(boolean stateCheck,
double entfernung)
|
(package private) void |
goToPosition(Coordinate aPos,
double speed)
player runs with given speed to given Coordinate |
(package private) void |
goToPosition(Coordinate aPos,
double speed,
double dist)
player runs with given speed to given Coordinate |
(package private) void |
goToPosition(Coordinate aPos,
double speed,
double dist,
boolean stateCheck)
player runs with given speed to given Coordinate |
(package private) void |
initPos()
moves the player to his initial Position by a move command |
(package private) boolean |
isBallTimeCurrent()
checks if information about ball is too old (less than tooOld cycles) |
(package private) void |
log()
lets the player say a stored log message |
(package private) void |
lookForBall()
lets the player look for the ball |
(package private) void |
pass(OtherPlayer aOtherPlayer,
int power)
lets the player pass the ball to the specified player |
(package private) void |
resetPos(double speed)
let the player return to his start position |
(package private) void |
resetPos(double speed,
double dist)
|
(package private) void |
resetPos(double speed,
double dist,
boolean stateCheck)
|
(package private) void |
resetViewMode()
reset view mode to width: normal and quality: high |
(package private) void |
stopBall()
stops the ball, considering the ball's direction and the ball's speed |
(package private) void |
turnBodyToObject(Coordinate objCoordinate)
lets the Player turn his body into the direction of the given Coordinate |
Methods inherited from class java.lang.Thread |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
PlayerInfo pi
Communication com
Action action
Manager manager
PlayMode playmode
ViewMode viewmode
StateDef state
Field field
java.lang.String serverName
int serverPort
java.lang.String teamName
Coordinate startPos
Coordinate standardPos
java.io.PrintWriter out
int nr
Log log
Constructor Detail |
public Player(java.lang.String serverName, int serverPort, java.lang.String teamName, boolean goalie)
Player
instanceserverName
- a String
object specifying the server nameserverPort
- a int
specifying the port of the serverteamName
- a String
object specifying the name of the teamgoalie
- a boolean
specifiying if player is goalieMethod Detail |
void checkIn()
void lookForBall()
void goToPosition(Coordinate aPos, double speed, double dist)
aPos
- a Coordinate
specifying the destinationspeed
- a double
specifying the speed of the playerdist
- a double
specifying how exactly the player should approach positionvoid goToPosition(Coordinate aPos, double speed, double dist, boolean stateCheck) throws StateException
aPos
- a Coordinate
specifying the destinationspeed
- a double
specifying the speed of the playerdist
- a double
specifying how exactly the player should approach positionStateException
- if state changesPlayModeException
- if playmode changesvoid goToPosition(Coordinate aPos, double speed)
aPos
- a Coordinate
specifying the destinationspeed
- a double
specifying the speed of the playervoid resetPos(double speed)
speed
- a int
specifying the speed of the playervoid resetPos(double speed, double dist)
void resetPos(double speed, double dist, boolean stateCheck) throws StateException
void initPos()
void goToFastBall(boolean stateCheck) throws PlayModeException, StateException
StateException
- if state changesPlayModeException
- if playmode changesvoid goToFastBall(boolean stateCheck, double entfernung) throws PlayModeException, StateException
void goToBall(boolean stateCheck) throws PlayModeException, StateException
StateException
- if state changesPlayModeException
- if playmode changesvoid pass(OtherPlayer aOtherPlayer, int power)
aOtherPlayer
- a OtherPlayer
objectvoid log()
void directKick(Coordinate coor, double power)
coor
- a Coordiante
specifying the destinationpower
- a double
specifying the power to kickvoid exactKick(Coordinate aPos, double power)
Coordinate
, after slightly kicking the ball to a
suitable positionaPos
- a Coordinate
object specifying the destinationpower
- a double
specifying the power to kickvoid directGoalKick()
void exactGoalKick()
void stopBall()
OtherPlayer getNearestEnemy()
OtherPlayer
objectOtherPlayer getNearestFriend()
OtherPlayer
objectOtherPlayer getFarestFriend()
OtherPlayer
objectboolean isBallTimeCurrent()
tooOld
cycles)boolean
specifying if information about the ball is up to datevoid turnBodyToObject(Coordinate objCoordinate)
objCoordinate
- a Coordinate
Coordinate getFutureBall()
Coordinate
specifying the future ball position, where the player's way to the ball is the shortestCoordinate getBall()
Coordinate
specifying the ball's current positiondouble getBallDir()
double
specifying the current relative direction of the balldouble getBallDist()
PlayerInfo
double
specifying the ball's current distance to the playerdouble getDirDist(Coordinate objCoordinate)
double
specifying the difference between the body direction of
the player an the direction of a Coordinate
double getDist(Coordinate c1, Coordinate c2)
double
the distance between two Coordinate
'svoid resetViewMode()
double getNormedDirection(double direction)
direction
- a double
specifying the desired directiondirection
a double
specifying the normed direction
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |