Two robots with parachutes

This classic puzzle can be found on many different websites (Spoilers!). It seems to originate from a Microsoft interview question. This is an interactive version of the puzzle where you can immediately try your ideas.

Two robots are to be parachuted onto random locations on an infinite line. When they land, their parachutes detach and remain where they are. The robots may be programmed from the following instruction set:

leftGo left one unit
rightGo right one unit
skipNextSkip next instruction if there is a parachute here
goto labelGo to label

Each of these instruction can be prepended by an optional label (label: instruction).

Your goal is to program the robots to meet (collide). They both run the same code.

Loading ...

A game by David Peter. Source code on Github.