Pergunta de entrevista da empresa IXL Learning

Write a class and method for Snake Game. I do not remember the exact rules. 1. map should be a 2D array 2. the position of the head and the body length/position are given by parameters 3. the snake can go up/down/left/right, and the head should not touch its body