Working with the grid

Give every cell a row and column. Read the related explanation.

Check the next cell

Move only if the destination is open. An obstacle blocks that move.

Keep the coordinate system

Use the same coordinates in the diagram and code.