core.player

## Class AbstractPlayer

- java.lang.Object
- - core.player.AbstractPlayer

- Direct Known Subclasses:
    Agent, Agent, Agent, Agent, Agent, Agent

      public abstract class AbstractPlayer
      extends java.lang.Object

  Created with IntelliJ IDEA. User: ssamot Date: 14/11/13 Time: 13:42 This is a Java port from Tom Schaul's VGDL - https://github.com/schaul/py-vgdl

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractPlayer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract Types.ACTIONS` | `act(StateObservation stateObs, ElapsedCpuTimer elapsedTimer)` Picks an action.
    `void` | `draw(java.awt.Graphics2D g)` Gets the player the control to draw something on the screen.
    `Types.ACTIONS` | `getLastAction()` Gets the last action executed by this controller.
    `void` | `logAction(Types.ACTIONS action)` Logs a single action
    `void` | `setup(java.lang.String actionFile, int randomSeed)` This function sets up the controller to save the actions executed in a given game.
    `void` | `teardown()` Closes the agent, writing actions to file.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractPlayer

          public AbstractPlayer()

  - ### Method Detail

    - #### act

          public abstract Types.ACTIONS act(StateObservation stateObs,
                          ElapsedCpuTimer elapsedTimer)

      Picks an action. This function is called every game step to request an action from the player. The action returned must be contained in the actions accessible from stateObs.getAvailableActions(), or no action will be applied.
      Parameters:
        `stateObs` - Observation of the current state.
        `elapsedTimer` - Timer when the action returned is due.
      Returns:
        An action for the current state

    - #### setup

          public final void setup(java.lang.String actionFile,
                   int randomSeed)

      This function sets up the controller to save the actions executed in a given game.
      Parameters:
        `actionFile` - file to save the actions to.
        `randomSeed` - Seed for the sampleRandom generator of the game to be played.

    - #### teardown

          public final void teardown()

      Closes the agent, writing actions to file.

    - #### logAction

          public final void logAction(Types.ACTIONS action)

      Logs a single action
      Parameters:
        `action` - the action to log.

    - #### getLastAction

          public Types.ACTIONS getLastAction()

      Gets the last action executed by this controller.
      Returns:
        the last action

    - #### draw

          public void draw(java.awt.Graphics2D g)

      Gets the player the control to draw something on the screen. It can be used for debug purposes.
      Parameters:
        `g` - Graphics device to draw to.