Made two separate functions collidesWithItself( ) and isDirectionReversed( ) to add the functionality of ending game whenever any of these two things happen. Attempted to change the codebase minimally by making two separate functions and an object to track the initialDirection of movement of the snake.
Made two separate functions collidesWithItself( ) and isDirectionReversed( ) to add the functionality of ending game whenever any of these two things happen. Attempted to change the codebase minimally by making two separate functions and an object to track the initialDirection of movement of the snake.