Package Delivery Grid

Write a function moveBot(commands, size) that simulates a delivery bot on a size x size grid. Cells are addressed as [row, col] with row 0 at the top and column 0 at the left. The bot starts at [0, 0].

Each command in commands is a string such as "right 3" or "down 2": a direction followed by a positive integer step count. Directions are right (increases col), left (decreases col), down (increases row), and up (decreases row).

The bot moves one cell at a time. A single step that would take the bot outside the grid is ignored, and the bot stays put for that step. After each step that lands on a new cell, that cell is recorded.

Return an object with the final position as [row, col] and the visited list of cells as "row,col" strings, in order of first visit, starting with "0,0".

Examples
Input: [[],3]
Output: {"position":[0,0],"visited":["0,0"]}
Hints

Package Delivery Grid

Move a delivery bot across a size by size grid one cell at a time, clamping every step inside the grid and recording the unique cells visited in order.