#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.

Stars
1.8k
License
MIT
Last commit
Apr 2026
Language
Python
Stars, last 30 weeks+54
2 May 2026: 1,744 stars9 May 2026: 1,747 stars16 May 2026: 1,749 stars23 May 2026: 1,750 stars30 May 2026: 1,753 stars6 Jun 2026: 1,755 stars13 Jun 2026: 1,759 stars20 Jun 2026: 1,760 stars27 Jun 2026: 1,762 stars4 Jul 2026: 1,765 stars11 Jul 2026: 1,768 stars18 Jul 2026: 1,768 stars25 Jul 2026: 1,768 stars1 Aug 2026: 1,770 stars8 Aug 2026: 1,770 stars15 Aug 2026: 1,774 stars22 Aug 2026: 1,778 stars29 Aug 2026: 1,780 stars5 Sept 2026: 1,783 stars12 Sept 2026: 1,783 stars19 Sept 2026: 1,785 stars26 Sept 2026: 1,787 stars3 Oct 2026: 1,789 stars10 Oct 2026: 1,791 stars17 Oct 2026: 1,791 stars24 Oct 2026: 1,792 stars31 Oct 2026: 1,792 stars7 Nov 2026: 1,794 stars14 Nov 2026: 1,795 stars21 Nov 2026: 1,797 stars28 Nov 2026: 1,798 stars

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
Also in Learning and cookbooks
RankProjectScore
#150introtodeeplearningJupyter notebook labs for MIT's Introduction to Deep Learning course8.9k starsMIT23 out of 100
#151machine-learning-specialization-courseraSolved notebooks for Andrew Ng's Coursera Machine Learning Specialization8.2k stars+102 (+1.3%) in 30 daysMIT23 out of 100
#153deep-q-learningMinimal DQN and Double DQN agents in Keras and Gymnasium1.3k starsMIT21 out of 100
#154ml-nlpChinese-language ML and NLP interview study notes with code examples17.8k starsno license19 out of 100
#155ai-engineering.academyStructured learning paths and notebooks for applied generative AI engineering2.4k starsMIT19 out of 100