Use: J=left, L=right, I=up, K=down, to move the snake and keep it from from hitting its tail. Enjoy
For an explanation of the code go: here