Classic game of snake in Javascript