function eatingDistanceValid(snake, food) {
    const snakeHead = snake.head();
    const snakeHeadCenter = {
        x: snakeHead.x + snake.snake_tile_size / 2,
        y: snakeHead.y + snake.snake_tile_size / 2
    }
    const x_distance = snakeHeadCenter.x - food.x;
    const y_distance = snakeHeadCenter.y - food.y;
    const distance = x_distance * x_distance + y_distance * y_distance;
    const eatingDistance = (snake.snake_tile_size + food.size) / 2;
    if (distance < eatingDistance * eatingDistance) {
        return true;
    }
    return false;
}
/**
 * check if snake is able to eat the input food based on current positions of snake and food
 * rule:
 * snake can eat food if distance between the center of snake's head and the center of the food
 * is less than <snake head's radius + food's radius> (which means snake head and food
 * item is overlapped)
 * @param {*} snake
 * @param {*} food 
 * @returns true if snake can eat food, false otherwise
 */
check if snake is able to eat the input food based on current positions of snake and food
rule:
snake can eat food if distance between the center of snake's head and the center of the food
is less than  (which means snake head and food
item is overlapped)
@param {*} snake
@param {*} food
@returns true if snake can eat food, false otherwise
check if snake is able to eat the input food based on current positions of snake and food rule : snake can eat food if distance between the center of snake ' s head and the center of the food is less than ( which means snake head and food item is overlapped ) @param { * } snake @param { * } food @returns true if snake can eat food false otherwise
function eatingDistanceValid(snake, food) {
    const snakeHead = snake.head();
    const snakeHeadCenter = {
        x: snakeHead.x + snake.snake_tile_size / 2,
        y: snakeHead.y + snake.snake_tile_size / 2
    }
    const x_distance = snakeHeadCenter.x - food.x;
    const y_distance = snakeHeadCenter.y - food.y;
    const distance = x_distance * x_distance + y_distance * y_distance;
    const eatingDistance = (snake.snake_tile_size + food.size) / 2;
    if (distance < eatingDistance * eatingDistance) {
        return true;
    }
    return false;
}
function eatingDistanceValid ( snake , food ) { const snakeHead = snake . head ( ) ; const snakeHeadCenter = { x : snakeHead . x + snake . snake_tile_size / 2 , y : snakeHead . y + snake . snake_tile_size / 2 } const x_distance = snakeHeadCenter . x - food . x ; const y_distance = snakeHeadCenter . y - food . y ; const distance = x_distance * x_distance + y_distance * y_distance ; const eatingDistance = ( snake . snake_tile_size + food . size ) / 2 ; if ( distance < eatingDistance * eatingDistance ) { return true ; } return false ; }
check if snake is able to eat the input food based on current positions of snake and food
 rule:
 snake can eat food if distance between the center of snake's head and the center of the food
 is less than <snake head's radius + food's radius> (which means snake head and food
 item is overlapped)
 @param {*} snake
 @param {*} food
 @returns true if snake can eat food, false otherwise
check if snake is able to eat the input food based on current positions of snake and food rule : snake can eat food if distance between the center of snake ' s head and the center of the food is less than <snake head ' s radius + food ' s radius > ( which means snake head and food item is overlapped ) @param { * } snake @param { * } food @returns true if snake can eat food false otherwise