Robots on a line | Microsoft interview
Two robots are placed at different points on a straight line of infinite length. When they are first placed down, they each spray out some oil to mark their starting points.
- Go left one space
- Go right one space
- Skip the next instruction if there is oil in my current spot
- Go to a label
[Note that a “label” is a name that refers to a line of your code. For example, you could label the third line of your program “surveying”. Then, the instruction “goto surveying” would jump to line 3 and start executing from there on the next cycle.]