Initialize a Queue to represent the snake's body, starting with the head at position (0,0).
Initialize a Hash Set to store the positions of the snake's body for quick collision checks.
Store the food positions in a list or array.
For each move:
a. Calculate the new head position based on the direction.
b. Check if the new head position is out of bounds or collides with the snake's body using the Hash Set. If so, return -1 (game over).
c. Check if the new head position is at the next food location. If so, increase the score and update the food list.
d. If no food is consumed, remove the tail from the Queue and Hash Set.
e. Add the new head to the Queue and Hash Set.