maurock / snake-ga

AI Agent that learns how to play Snake with Deep Q-Learning
528 stars 999 forks source link

Game screen is not shown #6

Closed KevinPedroza closed 1 year ago

KevinPedroza commented 4 years ago

When I run the game, it displays the window but the game does not show up the graphics. Just stay black.

I am on Mac

maurock commented 4 years ago

I set the display=True and the correct speed by default.

From a different issue, a user suggested:

This seems to be a OSX specific problem. To fix this problem, in update_screen(), add this line.

def update_screen(): pygame.display.update() pygame.event.get() # <--- Add this line:

Please let me know if this helps

bar-2 commented 4 years ago

I tried adding the additional line into the update_screen() method, but I'm getting still the same error. I'm also on a Mac.

Python Version 3.7.4 MacOS Version: Mojave 10.14.6

The other stuff seems to work, I can see output on the console, after setting up the parameters for training.

cheng10 commented 4 years ago

@KevinPedroza @maurock @bar-2 on macOS Mojave 10.14.6 (18G87), I got this issue fixed by simply(no need to add pygame.event.get() line): pip install pygame==2.0.0.dev4

It turns out that the default version installed by pip which is pygame 1.9.6 has some compatible issue with macOS mojave. check this thread here: https://github.com/pygame/pygame/issues/555