|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjp.ac.nii.icpc2010.players.AbstractPlayer
jp.ac.nii.icpc2010.players.BasePlayer
public class BasePlayer
Players may extend this class to receive some additional convenience functions. It is not necessary to extend BasePlayer; you may opt to extend AbstractPlayer directly instead.
AbstractPlayer
Field Summary |
---|
Fields inherited from class jp.ac.nii.icpc2010.players.AbstractPlayer |
---|
id, OBJECT_COIN, OBJECT_FREE, OBJECT_WALL, playField |
Constructor Summary | |
---|---|
BasePlayer(int id,
IPlayField playField)
|
Method Summary | |
---|---|
java.util.List<int[]> |
getAdjacentPos(int x,
int y)
Obtain the list of positions next to the current position. |
FieldDirection[] |
getDirs()
Obtain the array of directions |
java.util.ArrayList<java.lang.Integer> |
getEnemyIds()
Obtain the list of enemy ids |
FieldDirection |
getInput()
Override this method to control the agent. |
java.awt.Point |
getPosition(int id)
Obtain the position of the player |
int[] |
getPositionById(int id)
Obtain the position of the player |
java.util.List<FieldDirection> |
getRandomDirs()
Obtain the list of directions in randomised order |
java.util.List<FieldDirection> |
getSafeDirs(int x,
int y)
Obtain the array of safe directions |
boolean |
isCoin(int x,
int y)
Is there a coin on the cell? |
boolean |
isEnemyTron(int x,
int y)
Is it a trail of enemies? |
boolean |
isFree(int x,
int y)
Is it a free cell? |
boolean |
isMyTron(int x,
int y)
Is it a trail of my Tron? |
boolean |
isSafe(int x,
int y)
Is it safe to walk on the indicated coordinates? Currently this is true if it is either FIELD_FREE or FIELD_COIN. |
boolean |
isTron(int x,
int y)
Is it a trail? |
boolean |
isWall(int x,
int y)
Is it a wall? |
Methods inherited from class jp.ac.nii.icpc2010.players.AbstractPlayer |
---|
getId, getPlayField, getRemainingTime, getTrailId, getTrailIdOf, getTronIdOf, getX, getXOf, getY, getYOf, setFinishTime, setPlayField |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasePlayer(int id, IPlayField playField)
Method Detail |
---|
public java.util.ArrayList<java.lang.Integer> getEnemyIds()
public boolean isFree(int x, int y)
x
- Current position Xy
- Current position Y
public boolean isCoin(int x, int y)
x
- Current position Xy
- Current position Y
public boolean isWall(int x, int y)
x
- Current position Xy
- Current position Y
public boolean isMyTron(int x, int y)
x
- Current position Xy
- Current position Y
public boolean isEnemyTron(int x, int y)
x
- Current position Xy
- Current position Y
public boolean isTron(int x, int y)
x
- Current position Xy
- Current position Y
public boolean isSafe(int x, int y)
x
- Current position Xy
- Current position Y
public int[] getPositionById(int id)
id
- Target player's id
public java.awt.Point getPosition(int id)
id
- Target player's id
public FieldDirection[] getDirs()
public java.util.List<FieldDirection> getRandomDirs()
public java.util.List<FieldDirection> getSafeDirs(int x, int y)
x
- Current position Xy
- Current position Y
public java.util.List<int[]> getAdjacentPos(int x, int y)
x
- Current position Xy
- Current position Y
public FieldDirection getInput()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |