ALEx is an implementation of the Arcade Learning Environment for Elixir.
See the Installation Guide.
Interaction with ALEx is easy. First, create a new interface and set your confgiuration options:
# Create ALEx interface interface = Alex.new() # Set options interface = interface |> Alex.set_option(:display_screen, true) |> Alex.set_option(:random_seed, 123)
interface = Alex.new(display_screen: true, random_seed: 123)
Next, load a ROM:
# Load Tetris tetris = Alex.load(interface, "priv/tetris.bin")
Finally, play an episode:
episode = fn game, episode -> # If the game is over, return the score if Alex.game_over?(game) do game.reward else # Take a random action game = Alex.step(game, Enum.random(game.legal_actions)) episode.(game, episode) end end # Run an episode tetris = episode.(tetris, episode)
You can easily restart an episode with
tetris = episode.(tetris, episode) # Run it back from the start tetris = Alex.reset(tetris) tetris = episode.(tetris, episode)
ALEx allows you to take a screenshot of the current screen at any time using
# Run an episode tetris = episode(tetris, episode) # See how it ended Alex.screenshot(tetris)
You can provide a path. The default path is the current directory with the current UTC time.
ALEx supports all ROMS supported by the ALE. ROMs can be easily found on repositories online. ALEx will verify the checksum of a ROM automatically before loading it.
Supported ROMs has a list of all supported ROMs and their MD5 checksums.
See the Configuration Guide.
You'll want to check out the Arcade Learning Environment to learn more.
Additionally, you can check out the manual.