|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjp.ac.nii.icpc2010.players.AbstractPlayer
public abstract class AbstractPlayer
The AbstractPlayer class contains functions for querying the position of the players, details on the playfield and the remaining time per round.
This is the most basic class that all players must extend. Players also have the option to extend BasePlayer, which contains some additional convenience functions.
Playfields use a 2D coordinate system. X-values increase from left to right, and Y-values increase from top to bottom:
0----------------->x | ^ | -y | <-x +x> | +y | v | v y
For an explanation of tron IDs and trail IDs, see the IPlayField class.
IPlayField
Field Summary | |
---|---|
protected int |
id
ID of this player |
protected static int |
OBJECT_COIN
A coin. |
protected static int |
OBJECT_FREE
An empty square. |
protected static int |
OBJECT_WALL
A wall. |
protected IPlayField |
playField
Reference to the field information class. |
Constructor Summary | |
---|---|
AbstractPlayer(int id,
IPlayField playField)
|
Method Summary | |
---|---|
protected int |
getId()
Obtain the ID of this Tron. |
protected IPlayField |
getPlayField()
Obtain the current playfield. |
protected int |
getRemainingTime()
Obtain the remaining time to compute the current input. |
protected int |
getTrailId()
Get the Object ID of the trail of this player's tron |
protected int |
getTrailIdOf(int id)
Return the object ID of the trail of a given tron . |
protected int |
getTronIdOf(int trail)
Inverse of getTrailIdOf. |
protected int |
getX()
Get the X-coordinate of this player's tron. |
protected int |
getXOf(int id)
Given a tron id, this method returns the x-coordinate of the specified tron. |
protected int |
getY()
Get the Y-coordinate of this player's tron. |
protected int |
getYOf(int id)
Given a tron id, this method returns the y-coordinate of the specified tron. |
void |
setFinishTime(long finishTime)
Internal framework use only. |
void |
setPlayField(IPlayField playField)
Internal framework use only. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface jp.ac.nii.icpc2010.players.Player |
---|
getInput |
Field Detail |
---|
protected int id
protected IPlayField playField
protected static final int OBJECT_FREE
protected static final int OBJECT_WALL
protected static final int OBJECT_COIN
Constructor Detail |
---|
public AbstractPlayer(int id, IPlayField playField)
id
- the id of the tronplayField
- a reference of the playfieldMethod Detail |
---|
public final void setFinishTime(long finishTime)
finishTime
- public final void setPlayField(IPlayField playField)
playField
- protected int getId()
protected IPlayField getPlayField()
protected int getXOf(int id)
id
- the id of the tron
protected int getYOf(int id)
id
- the id of the tron
protected int getX()
protected int getY()
protected int getTrailIdOf(int id)
id
- the id of the tron
protected int getTrailId()
getTrailIdOf
protected int getTronIdOf(int trail)
trail
- the trail id
getTrailIdOf
protected int getRemainingTime()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |