---
# System prepended metadata

title: Interview Question -  Robot Simulator

---

# Interview Sep. 18
---
Let's create a simple simulator where a robot is placed in a world and has to execute a simple task. 
Our robot is a recycling bot, and is tasked with recovering trash from the world and bringing it to the processing station.

![](https://hackmd.io/_uploads/H1_NAQHkp.png)


* Robot:
    * Occupies one cell.
    * A differential robot that has a heading component. 
    * Executes two commands:
        * Forward/Backward -- Moves 1 cell towards current heading.
        * Turn Left/Right `theta` -- Rotates left/right by `theta` amount, where `1 * theta` is 90 degrees.

* World:
    * A discrete M x N grid world.
    * Generate random obstacles. A cell with an obstacle cannot be occupied by the robot.
    * Generate random trash to be pickup by the robot.
    * Place the Processing station in a random cell.

1. Write a simulation according to the description above.
2. Write an algorithm for the robot to pick up the trash efficiently.

* Focus on implementation quality, i.e. maintanability, readibility, good patterns and naming, etc.