The Wayback Machine - https://web.archive.org/web/20210613122237/https://github.com/CodeAltus/Snake-AI
Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
May 20, 2021
May 20, 2021
May 20, 2021
May 20, 2021
May 20, 2021
May 20, 2021

Snake AI

I created the PERFECT Snake AI using the A* pathfinding algorithm!

Implementation

The A* pathfinding algorithm was used to find the longest possible path between the snake's head and snake's tail. The apple is always on this path and it is eaten as the snake travels on this path. The snake is also never trapped as the snake's body leaves a way out for the snake's head. This program usually takes 1 hour to run.

Demo

You can see my Snake AI in action at https://codealtus.github.io/Snake-AI/

Disclaimer

I have run the AI ten times and it has worked perfectly but I can't be too sure if it is absolutely perfect. Feel free to use my code!

References

About

Using the A* pathfinding algorithm to play the classic snake game perfectly

Topics

Resources

Releases

No releases published

Packages

No packages published