Home

Awesome

Snake

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 >

Experiments

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):

SolverDemo (optimal)Average LengthAverage Steps
Hamilton63.93717.83
Greedy60.15904.56
DQN<br>(experimental)24.44131.69

Installation

Requirements: Python 3.6+ with Tkinter installed.

pip install -r requirements.txt
python run.py [-h]

Run unit tests:

python -m pytest

License

See the LICENSE file for license rights and limitations.