public abstract class AbstractPlayer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
AbstractPlayer.TimeoutException
An Exception thrown by
getOutputs() when the player's AI did not respond in time after an execute() . |
Constructor and Description |
---|
AbstractPlayer() |
Modifier and Type | Method and Description |
---|---|
void |
deactivate()
Deactivate a player.
|
void |
deactivate(java.lang.String reason)
Deactivate a player and adds a tooltip with the reason.
|
void |
execute()
Executes the player for a maximum of turnMaxTime milliseconds and store the output.
|
java.lang.String |
getAvatarToken()
Returns a string that will be converted into the real avatar by the viewer, if it exists.
|
int |
getColorToken()
Returns an integer that will be converted into the player's real color by the viewer.
|
abstract int |
getExpectedOutputLines()
Returns the number of lines that the player must return.
|
int |
getIndex()
Get player index from 0 (included) to number of players (excluded).
|
java.lang.String |
getNicknameToken()
Returns a string that will be converted into the real nickname by the viewer.
|
java.util.List<java.lang.String> |
getOutputs()
Gets the output obtained after an execution.
|
int |
getScore()
Get current score.
|
boolean |
isActive()
Returns true is the player is still active in the game (can be executed).
|
void |
sendInputLine(java.lang.String line)
Adds a new line to the input to send to the player on execute.
|
void |
setScore(int score)
Set current score.
|
public final java.lang.String getNicknameToken()
public final int getColorToken()
public final java.lang.String getAvatarToken()
public final boolean isActive()
public final int getIndex()
public final int getScore()
public final void setScore(int score)
score
- public final void deactivate()
public final void deactivate(java.lang.String reason)
reason
- Message to display in the tooltip.public final void sendInputLine(java.lang.String line)
line
- The input to send.public final void execute()
public final java.util.List<java.lang.String> getOutputs() throws AbstractPlayer.TimeoutException
AbstractPlayer.TimeoutException
public abstract int getExpectedOutputLines()