|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Brain
The Brain
class is used to compute and steer the actual
player. By receiving all necessary information from the Worldmodel
,
tactics and player-control are being considered.
Field Summary | |
private int |
actualTime
|
private boolean |
ballCatched
|
private double[] |
futurePos
|
private double[][] |
gamePos
|
private double[][] |
initPos
|
private int |
myNr
|
private Player |
player
|
private PlayerAction |
playerAction
|
private boolean |
playerChanged
|
private boolean |
playRight
|
private double[][] |
positions
|
private java.lang.String |
refereeMsg
|
private Worldmodel |
world
|
Constructor Summary | |
Brain(PlayerAction playerAction,
Player player,
Worldmodel world)
Creates a new Brain instance. |
Method Summary | |
private boolean |
atGamePos()
The atGamePos method is used to cause the player to go back
to the middle of his radius whenever the ball is not within reach |
private boolean |
atPoint(double x,
double y)
The atPoint method is used to recognize wheter a position
has been reached or not
atPoint = false ---> position is not reached (default)
atPoint = true ---> position is reached
|
private boolean |
ballCanBeSeen()
The ballCanBeSeen method test if ball can be seen |
private boolean |
ballInRadius()
The ballInRadius method test if ball is within the player´s action-radius |
private boolean |
ballKickAble()
The ballKickAble method test if ball is perfect to kick |
private java.lang.String |
buildMessage()
The buildMessage method builds message containing positions
to cry out to all the world message contains information in this order:
password myNr time0 x0 y0 time1 x1 y1 ... time22 x22 y22
all information is stored as integer |
private double |
calcAngle2Obj(double x,
double y)
The calcAngle2Obj method calculates angle to turn to face direction to an object.
|
private int |
calcDashPower(double x,
double y)
The calcDashPower method calculates power to dash using the distance to the coordinates to dash to
Author: Ramin Radpour |
private double |
calcDist(double x1,
double y1,
double x2,
double y2)
The calcDistr method calculates the distance between two objects
Author: Ramin Radpour |
private int |
calcKickPower(double x,
double y)
The calcKickPower method calculates power to kick the ball refering to distance of object to pass to. |
private double |
calcObjectDir(double oldX,
double oldY,
double actX,
double actY)
The calcObjectDir method calculates actual moving direction of an object by giving the angle to absangle back.
oldX, oldY are old and actX, actY actual positions of the object;
timedif is the diference between the timecycle of oldX/Y and actX/Y.
|
private void |
catchBall()
The catchBall method is the main routine of goalieAuthor: Anita Reifsteck (Implementation), Ramin Radpour (Implementation), Wini Appl (Transmission to GUI) |
private boolean |
enemyInFront()
The enemyInFront method test if one enemy in front of me |
private void |
freeKick()
The freeKick method is Goalie free kick after catching the ball
Author: Anita Reifsteck |
int |
friendHot()
The friendHot method calculates possible teammembers to pass to |
void |
gamePos()
The gamePos method defines the action-area.
|
private void |
getBall()
The getBall method makes the particular Player run to the ball.
|
private boolean |
goalKickGood()
The ballKickAble method test if own position is perfekt to kick to goal |
private void |
gotoPoint(double x,
double y)
The gotoPoint method moves player to given coordinates
Author: Ramin Radpour |
private void |
gotoPos()
The gotoPos method moves Player to his Game Position
Author: Thorsten Fiekert |
private void |
hearEvent()
The hearEvent method uses heared messages from teammembers to complete own positions
Author: Ramin Radpour |
void |
initPos()
The initPos method initial positions of all players at start
of game or after goal
Author: Thorsten Fiekert |
private void |
initStartPos()
The initStartPos method setting up start positions before
kickoff or after goal
Author: Ramin Radpour |
private boolean |
inMyOwnRadius()
The inMyOwnRadius method test if player is in his action-radius
This method is used to make sure that the player won´t leave his action-radius |
void |
play()
The play method is the main method
Author: Ramin Radpour,
Author: Patrick Ficher |
private void |
playHard()
The playHard method have many decisions, so it can really be called brainAuthor: Ramin Radpour (Implementation), Wini Appl (Transmission to GUI) |
private int |
whoIsNearest2Ball()
The whoIsNearest2Ball method finds out, which player from each team stands nearest to ball
[0]: own player nearest to ball [1]: enemy nearest to ball
[2]: distance ownPlayer to ball [3]: distance enemy to ball
Author: Ramin Radpour |
Methods inherited from class java.lang.Object |
|
Field Detail |
private Worldmodel world
private PlayerAction playerAction
private Player player
private double[][] initPos
private double[][] gamePos
private int myNr
private int actualTime
private double[][] positions
private java.lang.String refereeMsg
private double[] futurePos
private boolean ballCatched
private boolean playRight
private boolean playerChanged
Constructor Detail |
public Brain(PlayerAction playerAction, Player player, Worldmodel world)
Brain
instance.playerAction
- a PlayerAction
valueplayer
- a Player
valueworld
- a worldmodel
valuePlayerAction
,
Player
,
Worldmodel
Method Detail |
public void initPos()
initPos
method initial positions of all players at start
of game or after goal
Author: Thorsten Fiekert
private void initStartPos()
initStartPos
method setting up start positions before
kickoff or after goal
Author: Ramin Radpour
public void gamePos()
gamePos
method defines the action-area.
Actual positions during the game.
Author: Thorsten Fiekert
private java.lang.String buildMessage()
buildMessage
method builds message containing positions
to cry out to all the world message contains information in this order:
password myNr time0 x0 y0 time1 x1 y1 ... time22 x22 y22
all information is stored as integerString
message
Author: Ramin Radpour
private void catchBall()
catchBall
method is the main routine of goalieAuthor: Anita Reifsteck (Implementation), Ramin Radpour (Implementation), Wini Appl (Transmission to GUI)
private void freeKick()
freeKick
method is Goalie free kick after catching the ball
Author: Anita Reifsteck
public int friendHot()
friendHot
method calculates possible teammembers to pass tointeger
player number of teammember
Author: Ramin Radpour
private boolean inMyOwnRadius()
inMyOwnRadius
method test if player is in his action-radius
This method is used to make sure that the player won´t leave his action-radiusboolean
Author: Thorsten Fiekert
private boolean atGamePos()
atGamePos
method is used to cause the player to go back
to the middle of his radius whenever the ball is not within reachboolean
Author: Thorsten Fiekert
private boolean ballInRadius()
ballInRadius
method test if ball is within the player´s action-radiusboolean
Author: Thorsten Fiekert
private boolean ballCanBeSeen()
ballCanBeSeen
method test if ball can be seenboolean
Author: Ramin Radpour
private boolean atPoint(double x, double y)
atPoint
method is used to recognize wheter a position
has been reached or not
boolean
Author: Ramin Radpour
private boolean ballKickAble()
ballKickAble
method test if ball is perfect to kickboolean
Author: Ramin Radpour
private boolean enemyInFront()
enemyInFront
method test if one enemy in front of meboolean
Author: Ramin Radpour
private boolean goalKickGood()
ballKickAble
method test if own position is perfekt to kick to goalboolean
Author: Ramin Radpour
private void getBall()
getBall
method makes the particular Player run to the ball.
This one is a shortened command for the gotoPoint(double x, double y)
method for easier implementation.Author: Wini Appl
private void gotoPos()
gotoPos
method moves Player to his Game Position
Author: Thorsten Fiekert
private void gotoPoint(double x, double y)
gotoPoint
method moves player to given coordinates
Author: Ramin Radpour
private double calcAngle2Obj(double x, double y)
calcAngle2Obj
method calculates angle to turn to face direction to an object.
Author: Ramin Radpour
private double calcObjectDir(double oldX, double oldY, double actX, double actY)
calcObjectDir
method calculates actual moving direction of an object by giving the angle to absangle back.
oldX, oldY are old and actX, actY actual positions of the object;
timedif is the diference between the timecycle of oldX/Y and actX/Y.
Author: Ramin Radpour
private double calcDist(double x1, double y1, double x2, double y2)
calcDistr
method calculates the distance between two objects
Author: Ramin Radpour
private int calcDashPower(double x, double y)
calcDashPower
method calculates power to dash using the distance to the coordinates to dash to
Author: Ramin Radpour
private int calcKickPower(double x, double y)
calcKickPower
method calculates power to kick the ball refering to distance of object to pass to.x
- a double
positions to pass toy
- a double
positions to pass to
Author: Ramin Radpour
private int whoIsNearest2Ball()
whoIsNearest2Ball
method finds out, which player from each team stands nearest to ball
Author: Ramin Radpour
private void playHard()
playHard
method have many decisions, so it can really be called brainAuthor: Ramin Radpour (Implementation), Wini Appl (Transmission to GUI)
private void hearEvent()
hearEvent
method uses heared messages from teammembers to complete own positions
Author: Ramin Radpour
public void play()
play
method is the main method
Author: Ramin Radpour, Author: Patrick Ficher
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |