ALEx v0.3.2 Alex.Interface View Source

NIFs for interfacing with Arcade Learning Environment.

This module exposes the low-level interface for the Arcade Learning Environment. Use at your own risk.

Link to this section Summary

Types

t()

Abstraction around ALE Interface.

Functions

NIF. Performs specified action.

NIF. Creates a new ALE interface.

NIF. Returns the current state reference.

NIF. Returns the current system state reference.

NIF. Decodes serialized state.

NIF. Serializes the state reference.

NIF. Returns length of encoded state.

NIF. Determines if the game is over.

NIF. Gets available game difficulties.

NIF. Gets number of available difficulties.

NIF. Gets available game modes.

NIF. Gets number of available game modes.

NIF. Get boolean setting by key.

NIF. Gets current difficulty.

NIF. Gets the current episode frame number.

NIF. Get float setting by key.

NIF. Gets the current frame number.

NIF. Get integer setting by key.

NIF. Gets the current legal action set.

NIF. Gets the number of current legal actions.

NIF. Gets the minimal action set.

NIF. Gets the number of current minimal actions.

NIF. Gets the current RAM.

NIF. Gets the current RAM size.

NIF. Gets the current screen.

NIF. Gets the current screen in grayscale format.

NIF. Gets the current screen height.

NIF. Gets the current screen in RGB format.

NIF. Gets the current screen width.

NIF. Get string setting by key.

NIF. Gets the current number of lives.

NIF. Loads the specified ROM file.

NIF. Loads the current state.

NIF. Resets the game.

NIF. Restores the interface to specified state.

NIF. Restores the interface to specified system state.

NIF. Saves the current screen as png to path.

NIF. Saves the current state.

NIF. Sets key to boolean val.

NIF. Sets the difficulty of game.

NIF. Sets key to float val.

NIF. Sets key to integer val.

NIF. Sets mode of ALE logger.

NIF. Sets the game mode.

NIF. Sets key to string val.

Link to this section Types

Link to this type

t()

View Source
t() :: %Alex.Interface{
  difficulties: MapSet.t(integer()),
  difficulty: integer(),
  display_screen: boolean(),
  episode_frame: integer(),
  frame: integer(),
  legal_actions: MapSet.t(integer()),
  lives: integer(),
  minimal_actions: MapSet.t(integer()),
  mode: integer(),
  modes: MapSet.t(integer()),
  ram: Alex.RAM.t(),
  random_seed: integer(),
  ref: reference(),
  reward: number(),
  rom: String.t(),
  screen: Alex.Screen.t(),
  sound: boolean(),
  state: Alex.State.t()
}

Abstraction around ALE Interface.

The Interface struct contains all relevant information about the current ALE Interface. You should interact with this through the Alex module if you don't want to worry about interacting with the ALE reference.

Fields

  • :ref: Reference to ALE.
  • :rom: Path to loaded ROM.
  • :display_screen: Display screen option.
  • :random_seed: ALE random seed.
  • :sound: Play sound option.
  • :modes: Available game modes.
  • :mode: Current game mode.
  • :difficultues: Available difficultues.
  • :difficulty: Current difficulty.
  • :legal_actions: Current legal action set.
  • :minimal_actions: Current minimal action set.
  • :lives: Current number of lives.
  • :frame: Current frame number.
  • :episode_frame: Current episode frame number.
  • :screen: Current screen.
  • :state: Current state.
  • :ram: Current RAM.
  • :reward: Current score.

Link to this section Functions

NIF. Performs specified action.

Returns {:ok, reward}.

Parameters

  • ref: Reference to ALE.
  • action: Integer action.

NIF. Creates a new ALE interface.

Returns {:ok, #Reference<>}.

NIF. Returns the current state reference.

Returns {:ok, state}.

Parameters

  • ref: Reference to ALE.

NIF. Returns the current system state reference.

Not really sure what this does...

Returns {:ok, state}.

Parameters

  • ref: Reference to ALE.
Link to this function

decode_state(serial, len)

View Source

NIF. Decodes serialized state.

Returns {:ok, state}.

Parameters

  • state: serialized state.
  • len: length of serialized state.

NIF. Serializes the state reference.

Returns {:ok, encoded}.

Parameters

  • state: Reference to state.

NIF. Returns length of encoded state.

Returns {:ok, length}.

Parameters

  • state: Reference to state.

NIF. Determines if the game is over.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.
Link to this function

get_available_difficulties(ref)

View Source

NIF. Gets available game difficulties.

Returns {:ok, [...]}.

Parameters

  • ref: Reference to ALE.
Link to this function

get_available_difficulties_size(ref)

View Source

NIF. Gets number of available difficulties.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.
Link to this function

get_available_modes(ref)

View Source

NIF. Gets available game modes.

Returns {:ok, [...]}.

Parameters

  • ref: Reference to ALE.
Link to this function

get_available_modes_size(ref)

View Source

NIF. Gets number of available game modes.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.

NIF. Get boolean setting by key.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.
  • key: String key.

NIF. Gets current difficulty.

Returns {:ok, difficulty}.

Parameters

  • ref: Reference to ALE.
Link to this function

get_episode_frame_number(ref)

View Source

NIF. Gets the current episode frame number.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.

NIF. Get float setting by key.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.
  • key: String key.

NIF. Gets the current frame number.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.

NIF. Get integer setting by key.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.
  • key: String key.
Link to this function

get_minimal_action_set(ref)

View Source

NIF. Gets the minimal action set.

Returns {:ok, [...]}.

Parameters

  • ref: Reference to ALE.
Link to this function

get_minimal_action_set_size(ref)

View Source

NIF. Gets the number of current minimal actions.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.

NIF. Gets the current RAM.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.

NIF. Gets the current RAM size.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.

NIF. Gets the current screen.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.
Link to this function

get_screen_grayscale(ref)

View Source

NIF. Gets the current screen in grayscale format.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.

NIF. Gets the current screen height.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.

NIF. Gets the current screen in RGB format.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.

NIF. Gets the current screen width.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.

NIF. Get string setting by key.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.
  • key: String key.

NIF. Gets the current number of lives.

Returns {:ok, result}.

Parameters

  • ref: Reference to ALE.

NIF. Loads the specified ROM file.

Returns :ok.

Parameters

  • ref: Reference to ALE.
  • path: Path to ROM file.

NIF. Loads the current state.

Not really sure what this does...

Returns :ok.

Parameters

  • ref: Reference to ALE.

NIF. Resets the game.

Returns :ok.

Parameters

  • ref: Reference to ALE.
Link to this function

restore_state(ref, state)

View Source

NIF. Restores the interface to specified state.

Returns {:ok, state}.

Parameters

  • ref: Reference to ALE.
Link to this function

restore_system_state(ref, state)

View Source

NIF. Restores the interface to specified system state.

Not really sure what this does...

Returns :ok.

Parameters

  • ref: Reference to ALE.
Link to this function

save_screen_png(ref, path)

View Source

NIF. Saves the current screen as png to path.

Returns :ok.

Parameters

  • ref: Reference to ALE
  • path: Path to save.

NIF. Saves the current state.

Not really sure what this does...

Returns :ok.

Parameters

  • ref: Reference to ALE.

NIF. Sets key to boolean val.

Returns :ok.

Parameters

  • ref: Reference to ALE.
  • key: String key.
  • val: Boolean value.
Link to this function

set_difficulty(ref, diff)

View Source

NIF. Sets the difficulty of game.

Returns :ok.

Parameters

  • ref: Reference to ALE.
  • difficulty: Integer difficulty.
Link to this function

set_float(ref, key, val)

View Source

NIF. Sets key to float val.

Returns :ok.

Parameters

  • ref: Reference to ALE.
  • key: String key.
  • val: Float value.

NIF. Sets key to integer val.

Returns :ok.

Parameters

NIF. Sets mode of ALE logger.

Returns :ok.

Parameters

  • mode: 0, 1, or 2.

NIF. Sets the game mode.

Returns :ok.

Parameters

  • ref: Reference to ALE.
  • mode: Integer game mode.
Link to this function

set_string(ref, key, val)

View Source

NIF. Sets key to string val.

Returns :ok.

Parameters

  • ref: Reference to ALE.
  • key: String key.
  • val: String value.