Snake AI

This is an implementation of an algorithm that plays snake very well. It's based on a path through all board cells and calculated shortcuts to get more efficiency.
Controls:
X - showhide the path
Menu items:
ALG - controls which variant of the algorithm is used.
SPEED - Snake's speed, lower = faster.
SNAKE - Change snake visualisation.
The path was generated based on a Hilbert curve. It would work with any path that goes through all board cells, but the Hilbert curve has some nice properties and looks.
I have implemented two variants of this algorithm here, togglable in the menu. 'Tail' algorithm tends to follow it's tail very closely when it can't get directly to food. 'Blocky' algorithm curls on itself until it has a clear path to food resulting in big patches of snake body later in the game. I believe 'Tail' is more efficient than 'Blocky'.
Algorithm explanation:



Close
Connection Error!

Please check your connection and try again.