All problems

Robot Docking Radius Is Checked Using Manhattan Distance

Level 2 · node · Correctness · Manhattan distance used for a circular docking radius

Scenario

A fictional indoor robot service stores planar robot positions and checks whether each robot is within a circular charging station docking radius. A robot at (3,4) is exactly five meters from the origin but the current service rejects docking. Trace the repository, service, and controller to inspect the distance calculation.

Requirements

Use straight-line distance between the points for the circular docking radius and include its boundary. Reject positions outside the radius while preserving per-robot isolation, invalid coordinate and radius rejection, and rejection of unknown robots.

Acceptance criteria

  • A robot at (3,4) can dock within radius 5 around the origin.
  • A robot farther than the radius cannot dock.
  • A robot exactly on the radius boundary can dock.
  • Different robots keep independent positions.
  • Non-finite coordinate updates are rejected without changing the saved position.
  • Docking checks for unregistered robots are rejected.