snake with ai
Project description
snakai 有AI的贪吃蛇
snake is running! our project final goal is to build a snake game driven by Reinforcement Learning.
贪吃蛇出动!远期目标是实现强化学习驱动的贪吃蛇游戏。
Setting / 设置
language: Python3
package-name: snakai (snake + ai)
Start / 开始
# create env and active it
python -m venv snakai_env
source snakai_env/bin/activate
# install
pip install snakai
# or `pip install -e .` in dev mode
# run snake using QLearning based strategy.
run_snake -s qlearning
# `run_snake -s rule_based` to run in rule-based strategy, or `-s manual` to playing the game...
# `run_snake -h` to see all params
Attention: if you want to run
qlearning
based strategy, you need train it firstly.
Just go to qlearning-strategy and run thescripts'
script to train the model.
Currently, about 13 minutes is needed.
you will see following screen if no exception.
screen by the fantastic ScreenToGif
Progress / 进度
-
draw snake based on curses. 绘制贪吃蛇(控制台) ✅✅✅
从 https://gist.github.com/sanchitgangwar/2158089 下载了一个示例,照着学习。
- 完成 package 构建 & 配置上传到 pypi
-
rule-based strategy. 基于规则的AI ✅🔲🔲
- 完成一个基于规则的策略。目前看比较笨。之前调研的时候发现有用
哈密顿连通图
之类来做,后续可以试下。 - 另外,还准备试下
A*
算法,之前说好要在博客介绍一下 A* 算法的
- 完成一个基于规则的策略。目前看比较笨。之前调研的时候发现有用
-
RL-based strategy. 基于强化学习的AI [little milestone] ✅🔲🔲
- 目前做了基于
Q-Learning
的策略。具体见 qlearning-strategy. - 后续准备优化 & 尝试 Deep Q-Learning
- 目前做了基于
-
unity or some other game-engine driven snake? 基于其他游戏引擎的贪吃蛇? 🔲🔲🔲
日志
- 2021.08.08: 完成 qlearning 的基础版本。到此,最基础的策略都已经实现了!
- 2021.01.03: 再次重新组织代码结构,完成了策略逻辑和绘制逻辑的拆分
- 2019.12.28: 有空重新组织了代码结构,完成了绘制逻辑和状态逻辑的拆分;写了snake游戏的开发关键
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file snakai-1.1.tar.gz
.
File metadata
- Download URL: snakai-1.1.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
bfd17d1c1b258231a73652d82e5b04b3236a8c3fcaf58deac95ff949a9f0d0ed
|
|
MD5 |
1459d7a81071b9c7357e8c84a881054e
|
|
BLAKE2b-256 |
489af41d146ab680abe27b58355f897d41c4cb136aca947ac67b511be64def9e
|
File details
Details for the file snakai-1.1-py3-none-any.whl
.
File metadata
- Download URL: snakai-1.1-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
5b7dd23f244a441f65f25c55fec1af66dd864f85099660452ff6fe4830609248
|
|
MD5 |
b10c0318a0e566a1d7549c1331579a49
|
|
BLAKE2b-256 |
28ef1a2684f6374f28bd8bc6f624f0eddbfe82bf5288d9a41b2a69189d810837
|