This question evaluates a candidate's ability to design exploration and state-space search strategies for a robot operating in an unknown, partially blocked 2D grid using a constrained movement and sensing API, testing competency in traversal algorithms, state management, and handling limited observability.

You control a robot in an unknown 2D grid. The grid layout and boundaries are unknown, and you cannot access the map directly. Some cells are blocked (walls), others are open.
You can only interact with the environment through these methods:
bool move()
true
if the move succeeds; returns
false
if the cell in front is blocked (robot stays in place).
void turnLeft()
/
void turnRight()
bool isTarget()
true
if the robot is currently standing on the target cell.
The robot starts at an unknown start cell (treat it as the origin) facing an unknown but fixed initial direction.
Implement a procedure that finds the target and stops as soon as the robot reaches it.
Describe or implement a function such as:
bool findTarget(Robot& robot)
that returns true if it reaches the target (and stops searching immediately), otherwise false if the target is not reachable after exploring all reachable cells.