Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to port your neuroevolution code to OpenAI's Gym? #2

Open
ghost opened this issue Dec 21, 2017 · 1 comment
Open

How to port your neuroevolution code to OpenAI's Gym? #2

ghost opened this issue Dec 21, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 21, 2017

I code for hobby and want to learn about neuroevolution and came across your tutorial in google. But I have difficulty understanding what is happening with predict_action() and showGameOverScreen() functions. I tried to read from your orginal code in github but was overwhelmed by it. It contains both the code for neuroevolution algorithm and flappy bird game engine together which makes the code unredable for a novice. I had earlier worked with OpenAI's Gym and I its easy to work with games in OpenAI's Gym especially very basic CartPole-v0. How can I port your flappy bird genetic algorithm to gym's CartPole-v0

import gym
env = gym.make('CartPole-v0')
for i_episode in range(20):
    observation = env.reset()
    for t in range(100):
        env.render()
        print(observation)
        action = env.action_space.sample()
        observation, reward, done, info = env.step(action)
        if done:
            print("Episode finished after {} timesteps".format(t+1))
            break
@AroMorin
Copy link

Think about how the algorithm is evolving the weights. This will tell you how to implement the same algorithm to OpenAI Gym environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant