A helicopter drops two trains, each on a parachute, onto a straight infinite railway line. There is an undefined distance between the two trains. Each faces the same direction, and upon landing, the parachute attached to each train falls to the ground next to the train and detaches. Each train has a microchip that controls its motion. The chips are identical. There is no way for the trains to know where they are. You need to write the code in the chip to make the trains bump into each other. Each line of code takes a single clock cycle to execute.

You can use the following commands (and only these):

  • MF() - moves the train forward
  • MB() - moves the train backward
  • if(P) - conditional that's satisfied if the train is next to a parachute. There is no "then" to this IF statement.
  • goto

Server runs C#

NOTE: This textarea has been disconnected from the server-side code for security purposes. The text provided is compiled into C# code from a string on the server at runtime.

Train 1Train 2Time
Start position range is 0-50
Execution limit is 10 seconds
Seconds elapsed before bump:
Train 1 status: Not started
Train 2 status: Not started
Initial distance between trains: