public abstract class Player
extends java.lang.Object
Constructor and Description |
---|
Player() |
Modifier and Type | Method and Description |
---|---|
abstract Types.ACTIONS |
act(StateObservation stateObs,
ElapsedCpuTimer elapsedTimer)
Picks an action.
|
abstract Types.ACTIONS |
act(StateObservationMulti stateObs,
ElapsedCpuTimer elapsedTimer)
Picks an action.
|
void |
draw(java.awt.Graphics2D g)
Gets the player the control to draw something on the screen.
|
java.util.ArrayList<Types.ACTIONS> |
getAllActions()
Get the history of actions of this player.
|
Types.ACTIONS |
getLastAction()
Gets the last action executed by this controller.
|
int |
getPlayerID() |
boolean |
isHuman()
Indicates if this player is human controlled.
|
void |
logAction(Types.ACTIONS action)
Logs a single action
|
void |
result(StateObservation stateObs,
ElapsedCpuTimer elapsedCpuTimer)
Function called when the game is over.
|
void |
resultMulti(StateObservationMulti stateObs,
ElapsedCpuTimer elapsedCpuTimer) |
void |
setPlayerID(int id)
Set the ID of this player.
|
void |
setup(java.lang.String actionFile,
int randomSeed,
boolean isHuman)
This function sets up the controller to save the actions executed in a given game.
|
void |
teardown(Game played)
Closes the agent, writing actions to file.
|
public abstract Types.ACTIONS act(StateObservation stateObs, ElapsedCpuTimer elapsedTimer)
stateObs
- Observation of the current state.elapsedTimer
- Timer when the action returned is due.public abstract Types.ACTIONS act(StateObservationMulti stateObs, ElapsedCpuTimer elapsedTimer)
stateObs
- Observation of the current state.elapsedTimer
- Timer when the action returned is due.public void result(StateObservation stateObs, ElapsedCpuTimer elapsedCpuTimer)
stateObs
- the game state at the end of the gameelapsedCpuTimer
- timer when this method is meant to finish.public void resultMulti(StateObservationMulti stateObs, ElapsedCpuTimer elapsedCpuTimer)
public void setup(java.lang.String actionFile, int randomSeed, boolean isHuman)
actionFile
- file to save the actions to.randomSeed
- Seed for the sampleRandom generator of the game to be played.isHuman
- Indicates if the player is a human or not.public final void teardown(Game played)
public final void logAction(Types.ACTIONS action)
action
- the action to log.public Types.ACTIONS getLastAction()
public boolean isHuman()
public int getPlayerID()
public void setPlayerID(int id)
id
- - the player's IDpublic java.util.ArrayList<Types.ACTIONS> getAllActions()
public void draw(java.awt.Graphics2D g)
g
- Graphics device to draw to.