Shopify Interview Question

An agent navigating through a grid.