Gym dependencies

This notebook is the install space for all the dependencies of my first JSoC blog, which can be found here...

Install all dependencies

apt-get update
apt-get install build-essential -y
apt-get install ffmpeg
apt-get install scons clang
pkg"up; add Cairo"

Install package

pkg"add https://github.com/kraftpunk97/GymSpaces.jl"
pkg"add https://github.com/kraftpunk97/Gym.jl#toytext-demo;"
using Gym
env = make("CartPole-v0", :human_pane)
EnvWrapper(false, 0, 0, 0, true, 195, 200, Discrete(2, (2,)), Box(Float32[-4.8, -1.67772e7, -0.418879, -1.67772e7], Float32[4.8, 1.67772e7, 0.418879, 1.67772e7], (4,)), CartPoleEnv, CairoCtx(CartPoleDrawParams(0x00000190, 0x00000258, 4.8, 125.0, 0x00000064, 10.0, 125.0, 50.0, 30.0), CairoSurfaceBase{UInt32}(Ptr{Nothing} @0x0000000003391b30, 600.0, 400.0)), false)
reset!(env)
4-element Array{Float32,1}: -0.0422133 0.0410617 -0.00864827 0.0321839
render!(env)
env = make("Pong-greyNoFrameskip-v0", :human_pane)
EnvWrapper(false, 0, 0, 0, true, nothing, 400000, Discrete(6, (6,)), Box(UInt8[0x00 0x00 … 0x00 0x00; 0x00 0x00 … 0x00 0x00; … ; 0x00 0x00 … 0x00 0x00; 0x00 0x00 … 0x00 0x00] UInt8[0x00 0x00 … 0x00 0x00; 0x00 0x00 … 0x00 0x00; … ; 0x00 0x00 … 0x00 0x00; 0x00 0x00 … 0x00 0x00] UInt8[0x00 0x00 … 0x00 0x00; 0x00 0x00 … 0x00 0x00; … ; 0x00 0x00 … 0x00 0x00; 0x00 0x00 … 0x00 0x00], UInt8[0xff 0xff … 0xff 0xff; 0xff 0xff … 0xff 0xff; … ; 0xff 0xff … 0xff 0xff; 0xff 0xff … 0xff 0xff] UInt8[0xff 0xff … 0xff 0xff; 0xff 0xff … 0xff 0xff; … ; 0xff 0xff … 0xff 0xff; 0xff 0xff … 0xff 0xff] UInt8[0xff 0xff … 0xff 0xff; 0xff 0xff … 0xff 0xff; … ; 0xff 0xff … 0xff 0xff; 0xff 0xff … 0xff 0xff], (210, 160, 3)), AtariEnv(pong, grey), AtariCairoCtx(), false)
reset!(env)
render!(env)
pkg"add https://github.com/kraftpunk97/NES.jl"
using NES
environment_type = "smb"
action_type = :RIGHT_ONLY
env = SMBEnv(environment_type, action_type)
current_state = NES.reset!(env)
render(env) |> display
pkg"add https://github.com/kraftpunk97/DiffPong.jl"
using DiffPong
env = Env()
Env(Arena(Vector_(80.0, 80.0), Vector_(2.0, 2.0)), Player(16.0, Vector_(0.0, 32.0), 4, 0), Player(16.0, Vector_(80.0, 32.0), 2, 0), Ball(Vector_(40.0, 1.0), Vector_(3.0, -3.0), 1.0))
DiffPong.reset!(env)
DiffPong.render(env) |> display
env = make("Copy-v0", :human)
EnvWrapper(false, 0, 0, 0, true, 25, 200, TupleSpace((Discrete(2, (2,)), Discrete(2, (2,)), Discrete(5, (5,))), 3), Discrete(6, (6,)), CopyEnv(-1.0, 5, 0.0, Float32[], ['A', 'B', 'C', 'D', 'E', ' '], 2, TupleSpace((Discrete(2, (2,)), Discrete(2, (2,)), Discrete(5, (5,))), 3), Discrete(6, (6,)), (:left, :right), 1, Char[], Char[], 0, 1, 1, nothing, 0.0), HumanCtx(), false)
Gym.reset!(env)
1-element Array{Int64,1}: 5
Gym.render!(env)

Now one just needs to select `export environment` & save in the runner menu:

After publishing the article, everyone will be able to use the image, or download the docker image with the docker URL!

Now we can create a new runner with the newly created image, to test if our image actually works: