---
title: SnakeAI
canonical_url: "https://www.modelscope.cn/models/Genius-Society/SnakeAI"
md_url: "https://www.modelscope.cn/models/Genius-Society/SnakeAI.md"
repository: Genius-Society/SnakeAI
chinese_name: "贪吃蛇 AI 深度强化学习模型"
last_updated: 2026-08-05
license: "MIT License"
base_model:
  - Genius-Society/SnakeAI
base_model_relation: finetune
language:
  - en
downloads: 137
stars: 15
---

# SnakeAI

> SnakeAI - Genius-Society 在 ModelScope 开源的模型。本实验旨在通过深度强化学习算法（DQN 和 PPO）训练一个能够玩贪吃蛇游戏的人工智能代理。实验中，代理（即贪吃蛇）在游戏世界中行动，状态包括蛇头的坐标、蛇身的坐标列表、蛇头的方向、食物的坐标等。奖励机制基于蛇吃食物、获胜或失败的得分。实验使用 PyGame…

Genius-Society/SnakeAI 是 ModelScope 魔搭社区上的机器学习模型，采用 MIT License 许可，基于 Genius-Society/SnakeAI 构建。

- **Repository**: Genius-Society/SnakeAI
- **License**: MIT License
- **Base model**: Genius-Society/SnakeAI
- **Downloads**: 137
- **Stars**: 15
- **Last updated**: 2026-08-05

Source: https://www.modelscope.cn/models/Genius-Society/SnakeAI

---

训练贪吃蛇 AI 报告及模型权重

# 简介
本实验旨在通过深度强化学习算法 (DQN 和 PPO) 训练一个能够玩贪吃蛇游戏的人工智能智能体。实验中，智能体 (即 AI 控制的贪吃蛇) 在游戏世界中行动，状态包括蛇头的坐标、蛇身的坐标列表、蛇头的方向、食物的坐标等。奖励机制基于蛇吃食物、获胜或失败的得分。实验使用 PyGame 框架进行环境模拟，并通过调整奖励参数 (如吃食物的奖励保持不变，而死亡的惩罚逐渐增加) 来观察训练效果。结果显示，增加死亡的惩罚可以提高平均得分，而较低的死亡惩罚策略虽然在训练过程中表现不佳，但在实际演示中表现良好。未来的工作将尝试通过增加对蛇身曲折的惩罚来优化蛇的移动路径，并将保存的模型集成到 C++ 框架中。

## 使用
:modelscope-code[]{type="sdk"}

## 维护
:modelscope-code[]{type="git"}

## 训练曲线
| 轮       |                                                        1                                                         |                                                        2                                                         |                                                        3                                                         |
| :------- | :--------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------: |
| 吃食奖励 |                                                       +2.0                                                       |                                                       +2.0                                                       |                                                       +2.0                                                       |
| 撞墙惩罚 |                                                       -0.5                                                       |                                                       -1.0                                                       |                                                       -1.5                                                       |
| 被咬惩罚 |                                                       -0.8                                                       |                                                       -1.5                                                       |                                                       -2.0                                                       |
| 平均记录 |                                                       ≈19                                                        |                                                       ≈23                                                        |                                                       ≈28                                                        |
| 训练曲线 | ![round1](https://user-images.githubusercontent.com/20459298/233120722-d300c250-a07e-44c1-8986-d1f26d48c0f8.png) | ![round2](https://user-images.githubusercontent.com/20459298/233120780-43c9b35b-def6-4a57-b7b4-6599ad594c5c.png) | ![round3](https://user-images.githubusercontent.com/20459298/233120831-deb18303-25ec-4ff8-bafc-4726d1a81af4.png) |
| 评估效果 | ![round1](https://user-images.githubusercontent.com/20459298/233120884-b0ea6080-8aa4-4382-9ce5-90c22737cdf3.gif) | ![round2](https://user-images.githubusercontent.com/20459298/233121028-f9431608-3833-49d5-9cde-573fdb82c692.gif) | ![round3](https://user-images.githubusercontent.com/20459298/233121080-9a4f2e95-0f49-40cf-91a4-f7f57d4b861f.gif) |

## 实验报告
点击[这里](https://www.modelscope.cn/models/Genius-Society/SnakeAI/resolve/master/report.pdf)下载实验报告。

## 镜像
<https://huggingface.co/Genius-Society/SnakeAI>

## 致谢
 - <https://github.com/Genius-Society/SnakeAI>
