final implementation of snake game logic