This PR enhances game logic by using snakeArray to track snake length. The current score is calculated as the length minus one (accounting for the head block).
Before displaying "Game Over", it compares the highest score in local storage with the current score. If the current score beats the highest, it updates the local storage.
On game start, it checks for the highest score in local storage. If found, it displays this as the present score; otherwise, it initializes to zero.
These changes improve user experience, providing clearer scoring and enabling players to beat their own best scores.
![Uploading Screenshot 2024-03-15 at 1.29.07 AM.png…]()
1
This PR enhances game logic by using snakeArray to track snake length. The current score is calculated as the length minus one (accounting for the head block).
Before displaying "Game Over", it compares the highest score in local storage with the current score. If the current score beats the highest, it updates the local storage.
On game start, it checks for the highest score in local storage. If found, it displays this as the present score; otherwise, it initializes to zero.
These changes improve user experience, providing clearer scoring and enabling players to beat their own best scores.
![Uploading Screenshot 2024-03-15 at 1.29.07 AM.png…]()