Completed first working version of snake.js