Git Product home page Git Product logo

gym-snake's People

Contributors

anilzeybek avatar grantsrb avatar negation avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gym-snake's Issues

The extrahard env has rendering issue

This is what I get when I train it on DQN

Traceback (most recent call last):
File "C:\Users\mahes\anaconda3\lib\site-packages\gym\utils\closer.py", line 67, in close
closeable.close()
File "C:\Users\mahes\anaconda3\lib\site-packages\gym\core.py", line 188, in close
self.render(close=True)
File "C:\Users\mahes\Gym-Snake\gym_snake\envs\snake_extrahard_env.py", line 44, in render
self.viewer.imshow(self.last_obs)
File "C:\Users\mahes\anaconda3\lib\site-packages\matplotlib_init_.py", line 1492, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File "C:\Users\mahes\anaconda3\lib\site-packages\matplotlib\axes_axes.py", line 5756, in imshow
im.set_data(X)
File "C:\Users\mahes\anaconda3\lib\site-packages\matplotlib\image.py", line 723, in set_data
self._A = self._normalize_image_array(A)
File "C:\Users\mahes\anaconda3\lib\site-packages\matplotlib\image.py", line 693, in _normalize_image_array
raise TypeError(f"Invalid shape {A.shape} for image data")
TypeError: Invalid shape (8,) for image data
Exception ignored in: <function Env.del at 0x000001E853F6D4C0>
Traceback (most recent call last):
File "C:\Users\mahes\anaconda3\lib\site-packages\gym\core.py", line 252, in del
File "C:\Users\mahes\anaconda3\lib\site-packages\gym\core.py", line 188, in close
File "C:\Users\mahes\Gym-Snake\gym_snake\envs\snake_extrahard_env.py", line 43, in render
File "C:\Users\mahes\anaconda3\lib\site-packages\matplotlib\axes_base.py", line 1388, in clear
File "C:\Users\mahes\anaconda3\lib\site-packages\matplotlib\axes_base.py", line 1271, in __clear
File "C:\Users\mahes\anaconda3\lib\site-packages\matplotlib\axis.py", line 895, in clear
File "C:\Users\mahes\anaconda3\lib\site-packages\matplotlib\text.py", line 175, in _reset_visual_defaults
AttributeError: 'NoneType' object has no attribute '_val_or_rc'

Game does not render properly?

Hello. I found this seemingly flexible and aesthetic implementation of snake, and I wanted to try it out as soon as I could before training any model.

So, using the following code, I try to render a game with random movements gained from env.action_space.sample(), but what happens is only the first frame renders, and I get
<Figure size 576x396 with 0 Axes> returned for every frame thereafter.

Other OpenAI gym environments render correctly for me, so what am I doing wrong, or is this a bug?

My code:

import gym
import gym_snake

## Creating environment
env = gym.make('snake-v0')
obs = env.reset()

## Observing snake for now
obs = env.reset()

for _ in range(5): # run for 1000 steps
    env.render() # Render latest instance of game
    action = [env.action_space.sample()] # Random action
    env.step(action) # Implement action
    
env.close()

Is it possible to change the default colours for head/body/food/space?

It would be nice to be able to flatten the images to greyscale by averaging across the 3rd dimension in the observation array (i.e. reduce to a lower dimension), but currently the food colour becomes the same as the grid colour (85).

I tried changing this:
grid_object.FOOD_COLOR = [0,0,0] # Color of food units

But it seemed to have no effect?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.