This 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 ASAP. The old version of this project is written in C++. Now it has been rewritten using Python for a user-friendly GUI and the simplicity in the implementations of algorithms.
We use two metrics to evaluate the performance of an AI:
- Average Length: Average length the snake has grown to (max: 64).
- Average Steps: Average steps the snake has moved.
Test results (averaged over 1000 episodes):
|Solver||Demo (optimal)||Average Length||Average Steps|
Requirements: Python 3.5+ (64-bit) with [Tkinter][doc-tkinter] installed.
$ pip3 install -r requirements.txt # Use -h for more details $ python3 run.py [-h]
Run unit tests:
$ python3 -m pytest -v
Subscribe to Python Awesome
Get the latest posts delivered right to your inbox