|
--- |
|
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 | |
|
| :----------- | :--------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------: | |
|
| Traing curve |  |  |  | |
|
| Evaluation |  |  |  | |
|
| 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 | |
|
|
|
## Mirror |
|
<https://www.modelscope.cn/models/Genius-Society/SnakeAI> |
|
|
|
## Reference |
|
[1] <https://github.com/Genius-Society/SnakeAI> |