Skip to content

Commit

Permalink
add action_space response #26
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo C committed Feb 27, 2019
1 parent 45ecc1f commit 1fa84c0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions priv/python/gym_interface.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
import gym
from erlport.erlang import set_encoder, set_decoder


def make(envname):
print("πŸ”₯ πŸ”₯ πŸ”₯ Imporing Gym environment from Python:")
en = str(envname, encoding='ascii')
print("⏩ ⏩ ⏩ {0}".format(envname))
print("πŸ”₯ πŸ”₯ πŸ”₯ 😎")
env = gym.make(en)
initial_state = env.reset()
return (env, initial_state)
action_space = str(env.action_space).strip()
return (env, initial_state, action_space)


def step(env, _step):
observation = env.step(_step)
return (env, observation)


def render(env):
# env.env.ale.saveScreenPNG(b'test_image.png')
#res = env.render(mode='rgb_array')
env.render()


def reset(env):
initial_state = env.reset()
return (env, initial_state)
return (env, initial_state, str(env.action_space).strip())


def action_space_sample(env):
return env.action_space.sample()
return env.action_space.sample()

0 comments on commit 1fa84c0

Please sign in to comment.