broken snake.js code, in process of implementing continuous motion