Simple game of snake in javascript using html5 canvas elemnt