Design a Robot Operations CLI
Company: Shopify
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: easy
Interview Round: Technical Screen
# Design a Robot Operations CLI
Design a command-line tool that moves a robot up, down, left, and right by one step by default, supports turns and both single and batch commands, avoids obstacles, and provides a clear input/output experience.
### Constraints & Assumptions
- The coordinate system, initial position, initial direction, and turn semantics must be stated.
- Obstacle behavior must be explicit: reject a command, stop a batch, or report a partial result.
- The CLI should be testable without reading a real terminal.
### Clarifying Questions to Ask
- Does movement use absolute directions or forward movement relative to orientation?
- Can a batch continue after one blocked move?
- What output is needed after each command and at the end?
```hint Separate parsing from motion
Convert text into typed commands first, then apply them to a robot state through deterministic rules.
```
### What a Strong Answer Covers
- Command grammar, help, errors, and batch behavior.
- Robot state, orientation, obstacle lookup, and transition invariants.
- Clear output and partial-failure reporting.
- Testable architecture, complexity, and extension points.
### Follow-up Questions
1. How would undo or replay work?
2. How would you add multiple robots without mixing their state?
Overview: Design a testable robot-control CLI with typed commands, obstacle semantics, batch reporting, helpful errors, and clean state transitions.