|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrcssjava.WorldState
public class WorldState
Contains all information relevant to the instantaneous state of a game including the positions and velocities of the players and the ball. The world state can be from the perspective of the left or right sides, in which case all coordinates are in team-centric coordinates. If no side is specified, the concepts of "our team" and "opponent team" don't make sense; all coordinates are from the global (same as left team's) perspective. Using team-centric functions without setting a team has undefined and possibly very bad consequences.
Constructor Summary | |
---|---|
WorldState(ServerParams SP)
Constructs a world state with the specified server parameters. |
|
WorldState(ServerParams SP,
int side)
Constructs a world state from the given perspective |
Method Summary | |
---|---|
WorldState |
copy(WorldState ws)
Deep copy another world state into this |
VecPosition |
getBallPosition()
Get position of the ball |
VecPosition |
getBallVelocity()
Get velocity of the ball |
int |
getGoalDifference()
Get difference between our score and opponent's score |
int |
getHeteroPlayerType(int id)
Get heterogenous player type of the given player |
int |
getLeftScore()
Get score of left team |
java.lang.String |
getLeftTeamName()
Get left team's name |
int |
getOpponentID(int unum)
Get player ID of opponent with given uniform number |
int |
getOppScore()
Get score of opponent team |
int |
getOppSide()
Get opponent's side |
java.lang.String |
getOppTeamName()
Get opponent team's name |
int |
getOurScore()
Get score of our team |
int |
getOurSide()
Get perspective |
java.lang.String |
getOurTeamName()
Get our team's name |
double |
getPlayerBodyAngle(int id)
Get body angle of the given player |
double |
getPlayerNeckAngle(int id)
Get neck angle of the given player |
VecPosition |
getPlayerPosition(int id)
Get position of given player |
VecPosition |
getPlayerVelocity(int id)
Get velocity of the given player |
int |
getPlayMode()
Get play mode |
java.lang.String |
getPlayModeString()
Get play mode as String |
VecPosition |
getPosition(int id)
Get position of given object |
int |
getRightScore()
Get score of right team |
java.lang.String |
getRightTeamName()
Get right team's name |
int |
getScore(int side)
Get score of given team |
int |
getSideFromTeamName(java.lang.String teamName)
Get side from team name |
int |
getTeammateID(int unum)
Get player ID of teammate with given uniform number |
java.lang.String |
getTeamName(int side)
Get our team name for given side |
java.lang.String |
getTeamNameFromPlayer(int id)
Get team name of given player |
int |
getTime()
Get current cycle |
int |
getTimeSinceSeenBall()
Get number of cycles that have passed since the ball information was updated |
int |
getTimeSinceSeenPlayer(int id)
Get number of cycles that have passed since the information for the given player was updated |
VecPosition |
getVelocity(int id)
Get velocity of the given object |
boolean |
isBallKickableBy(int id)
Is the ball close enough to the given player to be kicked? |
boolean |
isOnSidelines(int id)
Is player "dead" or waiting on sidelines? |
boolean |
isOpponent(int id)
Is player our opponent? |
boolean |
isTeammate(int id)
Is player our teammate? |
void |
setLeftScore(int score)
Set score of left team |
void |
setLeftTeamName(java.lang.String teamName)
Set name of left team |
void |
setOppScore(int score)
Set score of opponent team |
void |
setOppTeamName(java.lang.String teamName)
Set opponent team's name |
void |
setOurScore(int score)
Set score of our team |
void |
setOurTeamName(java.lang.String teamName)
Set our team's name |
void |
setPlayMode(int playMode)
Set play mode |
void |
setRightScore(int score)
Set score of right team |
void |
setRightTeamName(java.lang.String teamName)
Set name of left team |
void |
setScore(int side,
int score)
Set score of given team |
void |
setSide(int side)
Set perspective |
void |
setSideFromTeamName(java.lang.String teamName)
Set perspective to the side corresponding to the given team name |
void |
setTeamName(int side,
java.lang.String teamName)
Set team name for a given side |
void |
updateBall(VecPosition pos,
VecPosition vel)
Update ball information |
void |
updatePlayer(int id,
VecPosition pos,
VecPosition vel,
double angBody,
double angNeck)
Update player information for given player |
void |
updateTime(int time)
Set current cycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WorldState(ServerParams SP)
SP
- server parameterspublic WorldState(ServerParams SP, int side)
SP
- server parametersside
- side of observerMethod Detail |
---|
public WorldState copy(WorldState ws)
ws
- another world state
public void updateTime(int time)
time
- time in cyclespublic int getTime()
public void setPlayMode(int playMode)
playMode
- play modepublic int getPlayMode()
public java.lang.String getPlayModeString()
public void setSide(int side)
side
- side of observerpublic int getOurSide()
public int getOppSide()
public int getSideFromTeamName(java.lang.String teamName)
teamName
- name of team as sent to server
public void setSideFromTeamName(java.lang.String teamName)
teamName
- name of teampublic void setTeamName(int side, java.lang.String teamName)
side
- side of team to updateteamName
- name of teampublic void setLeftTeamName(java.lang.String teamName)
teamName
- name of teampublic void setRightTeamName(java.lang.String teamName)
teamName
- name of teampublic void setOurTeamName(java.lang.String teamName)
teamName
- name of teampublic void setOppTeamName(java.lang.String teamName)
teamName
- name of teampublic java.lang.String getTeamName(int side)
side
- side of team
public java.lang.String getLeftTeamName()
public java.lang.String getRightTeamName()
public java.lang.String getOurTeamName()
public java.lang.String getOppTeamName()
public java.lang.String getTeamNameFromPlayer(int id)
id
- player ID
public void setScore(int side, int score)
side
- side of teamscore
- new scorepublic void setLeftScore(int score)
score
- new scorepublic void setRightScore(int score)
score
- new scorepublic void setOurScore(int score)
score
- new scorepublic void setOppScore(int score)
score
- new scorepublic int getScore(int side)
side
- side of team
public int getLeftScore()
public int getRightScore()
public int getOurScore()
public int getOppScore()
public int getGoalDifference()
public boolean isTeammate(int id)
id
- player ID
true
if player is on our teampublic boolean isOpponent(int id)
id
- player ID
true
if player is on opponent teampublic int getTeammateID(int unum)
unum
- uniform number 1-11
public int getOpponentID(int unum)
unum
- uniform number 1-11
public boolean isOnSidelines(int id)
id
- player ID
true
if player is at y coordinate for sidelinespublic void updateBall(VecPosition pos, VecPosition vel)
pos
- new ball positionvel
- new ball velocitypublic void updatePlayer(int id, VecPosition pos, VecPosition vel, double angBody, double angNeck)
id
- player IDpos
- new player positionvel
- new player velocityangBody
- new body angleangNeck
- new neck anglepublic VecPosition getBallPosition()
public int getTimeSinceSeenBall()
public VecPosition getPlayerPosition(int id)
id
- player ID
public int getTimeSinceSeenPlayer(int id)
id
- player ID
public VecPosition getPosition(int id)
id
- object ID
public VecPosition getBallVelocity()
public VecPosition getPlayerVelocity(int id)
id
- player ID
public VecPosition getVelocity(int id)
id
- object ID
public double getPlayerBodyAngle(int id)
id
- player ID
public double getPlayerNeckAngle(int id)
id
- player ID
public int getHeteroPlayerType(int id)
id
- player ID
public boolean isBallKickableBy(int id)
id
- player ID
true
if ball is kickable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |