File size: 4,498 Bytes
497f119 f3346f4 118391f 497f119 118391f 497f119 118391f 497f119 118391f 497f119 e66de14 19d4430 497f119 118391f 497f119 e66de14 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
---
license: mit
---
PPO Snake AI Report & weights after training
## Intro
This experiment aims to train an artificial intelligence agent to play the Snake game using deep reinforcement learning algorithms(DQN and PPO).The agent(i.e.,the snake)operates within a game environment,with states including the coordinates of the snake's head,the coordinate list of the snake's body,the direction of the snake's head,and the coordinates of the food.The reward mechanism is based on scores for eating food,winning,or losing.The experiment uses the PyGame framework for environment simulation and adjusts reward parameters(such as keeping the reward for eating food constant while gradually increasing the penalty for death)to observe training outcomes.The results show that increasing the penalty for death leads to higher average scores,while a strategy with a lower death penalty performs poorly during training but well in demonstrations.Future work will attempt to optimize the snake's movement by adding penalties for excessive zigzagging and integrating the saved model into a C++framework.
## Usage
### Download
```python
from modelscope import snapshot_download
model_dir = snapshot_download('Genius-Society/SnakeAI')
```
### Maintenance
```bash
git clone git@hf.co:Genius-Society/SnakeAI
cd SnakeAI
```
## Training curve
| Round | 1 | 2 | 3 |
| :----------- | :--------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------: |
| Reward_eat | +2.0 | +2.0 | +2.0 |
| Reward_hit | -0.5 | -1.0 | -1.5 |
| Reward_bit | -0.8 | -1.5 | -2.0 |
| Avg record | ≈19 | ≈23 | ≈28 |
| Traing curve |  |  |  |
| Evaluation |  |  |  |
## Report
Click [here](https://www.modelscope.cn/models/Genius-Society/SnakeAI/resolve/master/report.pdf) to download the experiment report.
## Mirror
<https://www.modelscope.cn/models/Genius-Society/SnakeAI>
## Thanks
- <https://github.com/Genius-Society/SnakeAI> |