liuguiyangnwpu / Snake

Artificial intelligence of the Snake game.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snake

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.

Algorithm Details >

Experiments

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

  1. Success Rate: Rate of success (i.e., the map is filled with the snake's bodies) after playing the game for N times.
  2. Average Steps: Average steps the snake has taken to success.

Test results (N=1000):

Solver Demo Success Rate Average Steps
Hamilton 100.0% 1776
Greedy 27.4% 1575

Installation

Requirements: Python 3.5+ with Tkinter installed.

$ pip3 install -r requirements.txt
$ python3 run.py

Run unit tests:

$ python3 -m pytest -v

License

See the LICENSE file for license rights and limitations.

About

Artificial intelligence of the Snake game.

License:MIT License


Languages

Language:Python 100.0%