A snake starts at the top-left cell (0,0) of a width x height grid, length 1. Food appears at given cells in order. For each move ('U','D','L','R'), the snake advances; eating food grows it and scores a point. The game ends (result -1) if the snake hits a wall or its own body. Given the grid size, the food list, and the moves, return the score after each move (or -1 at the ending move, after which no further moves are processed). The input is JSON {width, height, food, moves}.
Input: JSON {width, height, food, moves}.
Output: Array — the score after each move (or -1).
Input: {"width":3,"height":2,"food":[[1,2],[0,1]],"moves":["R","D","R","U","L","U"]}
Output: [0,0,1,1,2,-1]
Explanation: Two foods eaten before the snake dies.Input: {"width":2,"height":2,"food":[],"moves":["R"]}
Output: [0]
Explanation: No food, valid move.Input: {"width":2,"height":2,"food":[],"moves":["U"]}
Output: [-1]
Explanation: Moving off the grid.1<=width,height<=100