You can check the app from this; Sandbox
The logic of the snake movement is removing one square from its back and adding a new head basically. This creates an appearance like moving. But my interval doesn't seem to work correctly.
It works only for once then it's doing the same thing over and over again. Which means that state is not changing at all after one time.
I saw this in a video where someone was developing this game exactly this way but it was working. I can't see what's wrong with this code, thanks in advance.