#152152nd of 171 in Learning and cookbooks
snake
Snake game player using graph search and a Double DQN agent
Run it:Vast.ai ↗ (opens in a new tab)Clore.ai ↗ (opens in a new tab)Affiliate links, no effect on a rank.
Watch puts snake on your watch list: its new releases and known problems since your last visit. Kept in this browser, no account.snake is on your watch list. Its new releases and problems show there.
- Stars
- 1.8k
- License
- MIT
- Last commit
- Apr 2026
- Language
- Python
1,744 on 2 May 20261,798 on 28 Nov 2026
From GitHub's daily star counts.
Checked on GitHub.
Overview
Plays Snake on a 6x6 grid with two agents: a rule-based graph search (Hamiltonian path, shortest path, longer-path detours) and a Double DQN reinforcement learning agent in PyTorch. The README reports graph search at 94% success and 35.86 average length, and RL at 50% and 29.33, over 1000 rounds. A pre-trained model and a training script are included.
Who it is for: Learners studying game-playing search and DQN on a small example
Strengths
- Graph search agent clears the 6x6 grid in 94% of 1000 rounds
- Includes pre-trained rl_model.pt and rl_train.py to retrain the DQN
- Algorithms explained step by step with links to source lines
- Graph search needs only pip requirements; PyTorch only for RL
Weaknesses
- Fixed 6x6 grid; Hamiltonian search is NP-complete and relies on the small size
- RL agent reaches max length in only 50% of rounds
- No releases or packaging; run as plain scripts
- Single toy game, not a reusable RL or search library
What it needs
- GPU optional
- Needs Python >= 3.10, PyTorch (optional, for RL)
- Models: Double DQN (PyTorch)
Also in Learning and cookbooks
See all 171| Rank | Project | Score |
|---|---|---|
| #150 | introtodeeplearningJupyter notebook labs for MIT's Introduction to Deep Learning course | 23 out of 100 |
| #151 | machine-learning-specialization-courseraSolved notebooks for Andrew Ng's Coursera Machine Learning Specialization | 23 out of 100 |
| #153 | deep-q-learningMinimal DQN and Double DQN agents in Keras and Gymnasium | 21 out of 100 |
| #154 | ml-nlpChinese-language ML and NLP interview study notes with code examples | 19 out of 100 |
| #155 | ai-engineering.academyStructured learning paths and notebooks for applied generative AI engineering | 19 out of 100 |