Awesome Open Source
Awesome Open Source


The project focuses on the artificial intelligence of the Snake game. The snake's goal is to eat the food continuously and fill the map with its bodies as soon as possible. Originally, the project was written in C++. It has now been rewritten in Python for a user-friendly GUI and the simplicity in algorithm implementations.

Algorithms >


We use two metrics to evaluate the performance of an AI:

  1. Average Length: Average length the snake has grown to (max: 64).
  2. Average Steps: Average steps the snake has moved.

Test results (averaged over 1000 episodes):

Solver Demo (optimal) Average Length Average Steps
Hamilton 63.93 717.83
Greedy 60.15 904.56
24.44 131.69


Requirements: Python 3.5+ (64-bit) with Tkinter installed.

$ pip3 install -r requirements.txt

# Use -h for more details
$ python3 [-h]

Run unit tests:

$ python3 -m pytest -v


See the LICENSE file for license rights and limitations.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
python (52,051
game (1,001
artificial-intelligence (619
reinforcement-learning (546
algorithm (494
deep-reinforcement-learning (198
graph-theory (28
snake (17

Find Open Source By Browsing 7,000 Topics Across 59 Categories