SnakeAI

The following algorithm is able to beat any Snake game with at least one dimension being an even number. It works by generating a Hamiltonian circuit and accordingly following it while constantly executing shortcuts to eat the food without possibly trapping itself. Inspirational was taken from the following blog post: https://johnflux.com/2015/05/02/nokia-6110-part-3-algorithms/.

Credits to my group member, Jason Liu, and Saima Ali for the original Snake API template for which the algorithm was implemented.