Java-Snake-Game icon indicating copy to clipboard operation
Java-Snake-Game copied to clipboard

Snake can pass through its own body when length is 5

Open Zsozsiii opened this issue 1 month ago • 0 comments

Self-collision is not always detected when the snake has length 5. In certain configurations the head can move onto a cell occupied by its own body segment without triggering game over. When the snake grows to 5 segments and is steered into its own body, the game sometimes continues instead of ending. From the player’s perspective, the snake “passes through” itself instead of dying immediately on self-collision. As soon as the snake’s head moves onto any of its own body segments, the game should end and the game over state should be triggered

Zsozsiii avatar Dec 06 '25 13:12 Zsozsiii