You might have found while playing our little game that you can make the snake turn back on itself or it even goes through itself. Anyone who remembers the original will know that this results in an immediate game over!
What we are going to look at now can essentially be split into two parts. First, we will fix the snake's ability to slither back on itself, as seen in the following screenshot:
Second, we will look at stopping the game when the snake collides with another part of its body, as seen in the following screenshot: