Using deep reinforcement learning to play Snake game(贪吃蛇).
The used algorithm is PPO for discrete! It has the brilliant performance in the field of discrete action space just like in continuous action space.
You just need half an hour to train the snake and then it can be as smart as you.
Agent.py: file to store the algorithm.
core.py: file to store the net for DRL algorithm.
draw.py: file to draw the reward curve.
env4Snake.py: the environment for snake game.
main.py: the main func.
what you need to do is to run the main.py and then run the env4Snake to test your mdoel!
- torch
- numpy
- seaborn==0.11.1
- pygame==2.0.1
- matplotlib==3.2.2
- PIL(This is unimportant. I do not use this package in running process.)
See my blog for details: https://blog.csdn.net/weixin_43145941/article/details/118639211