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