Author: Thomas Breloff
AtariAlgos wraps the ArcadeLearningEnvironment as an implementation of an AbstractEnvironment
from the Reinforce interface. This allows it to be used as a plug-and-play module with general reinforcement learning agents.
Setup:
Pkg.clone("https://github.com/JuliaML/AtariAlgos.jl")
(Optional) Download roms:
using AtariAlgos
AtariAlgos.download_roms()
Games can also be "plotted" using Plots.jl through a simple definition of a recipe for AtariEnv
objects, allowing it to be a component of more complex visualizations for tracking learning progress and more, as well as making it easy to create animations.
using AtariAlgos
# construct a game of Breakout
game = AtariEnv("breakout")
# set up for plotting
using Plots
gr(size=(200,300), leg=false)
rewards = Float64[]
# run the episode using the Episode iterator, creating an animated gif in the process
@gif for sars in Episode(game, RandomPolicy())
push!(rewards, sars[3])
plot(
plot(game),
sticks(rewards, yticks=nothing),
layout=@layout [a;b{0.2h}]
)
end every 10