Training a Snake in OpenAI Gym

A response to a low-level request for research

In OpenAI’s “Requests for Research 2.0”, the OpenAI team lists a few interesting ideas. Here’s an example of one:

⭐ Implement a clone of the classic Snake game as a Gym environment, and solve it with a reinforcement learning algorithm of your choice. Tweet us videos of the agent playing. Were you able to train a policy that wins the game?

In the grand scheme of OpenAI’s research requests, this one is in the category of “warmups”. With that in mind, I figured making the thought process behind this publically available would help others in trying to get to the more advanced requests.

Some guides on gym-creation:

Some past implementations of this:

Subscribe to know whenever I post new content. I don't spam!

At least this isn't a full screen popup

That would be more annoying. Anyways, if you like what you're reading, consider subscribing to my newsletter! I'll notify you when I publish new posts - no spam.