Robot Room Cleaner
A robot is placed in a rectangular room and must clean every spot it can reach. The room is hidden from your solution. The judge owns the room matrix, the starting cell, and the robot's initial pose, and hands your code only an opaque Robot handle. Your task is to explore a room you cannot see.
Write solve(robot). It receives one argument:
robot: the judge-owned handle. It starts at the hidden start cell facing up (north).
solve returns nothing. After it finishes, the judge reads its own set of cleaned cells and reports the number of distinct cells cleaned as the observed result. That observed count is compared with expected, which is the size of the connected open region containing the start cell. In the official domain every open cell belongs to that region, so expected is also the total number of open cells in the room.
The robot exposes exactly four methods, and they are the only way to interact with the room:
move(): moves the robot one cell forward. Returnstrueif the robot moved, orfalseif a wall or the edge of the room blocks it. A blockedmove()leaves the robot on its current cell and facing the same direction.turnLeft(): rotates the robot 90 degrees counter-clockwise.turnRight(): rotates the robot 90 degrees clockwise.clean(): cleans the robot's current cell. Cleaning an already clean cell has no effect.
You do not receive the room matrix, the start coordinates, or the robot's current position or heading. Track position yourself in a local coordinate system that begins at (0, 0) with direction 0 (up); a successful move() advances that coordinate by one step in the current direction. Because move() only enters open, in-bounds cells, every cell you clean is reachable. The room is rectangular with at most 100 rows and 200 columns, and every open cell is reachable from the start, so a complete depth-first walk cleans every open cell.
Robot interface (judge side)
Robot # owned entirely by the judge; not constructed by your code
move() -> boolean # step forward if the target cell is open and in bounds
turnLeft() -> void # rotate 90 degrees counter-clockwise
turnRight() -> void # rotate 90 degrees clockwise
clean() -> void # clean the current cell
# room, pose, and cleaned set stay private to the judge
cleanedCount -> number # judge reads this after solve returns; this is the observed result
How grading works (and why there is no grid argument)
A fixture still lists its environment as [room, startRow, startCol] together with an expected count. Those first three slots are judge-only descriptors: the harness uses them to build the private robot and never forwards them to solve. The user signature is solve(robot) and nothing else, so submitted code has no grid to read and no flood-fill shortcut exists. The only way to make the observed cleaned count equal expected is to drive the robot across every reachable open cell using the four methods.
Robot Room Cleaner
A robot is placed in a rectangular room and must clean every spot it can reach. The room is hidden from your solution. The judge owns the room matrix, the starting cell, and the robot's initial pose, and hands your code only an opaque `Robot` handle. Your task is to explore a room you cannot see.