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

Answer Posted / raghav

In answer #4 , I think there is no need of these 3 lines
MF
MF
MB
Instead we can use only 1 line
MF

Both produces the same result but 1 line command is more efficient i think.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

falling height is proportional to square of the time. one object falls 64cm in 2sec than in 6sec from how much height the object will fall.

720


A team P of 20 engineers can complete a task in 32 days. Another team Q of 16 engineers can complete the same task in 30 days. Then the ratio of working capacity of 1 member of P to that of a member of Q is:

1051


If A=Z, B=Y, C=X, .......... Z=A, Then SOUR = ?

656


there are two categories of persons in ratio a:b = 2:3. A type earns 2.5 dollars/hr and b type 1 dollar/hr total money earned by both is 24dollars. Then what is the total number of persons

682


There are 19 red balls and one black ball . Ten balls are put in one jar and the remaining 10 are put in another jar. what is the possibility that the black is in the right jar.

848






USA + USSR = PEACE ; P + E + A + C + E = ?

1156


Want to get some material for apptitud e for banking preparation

2193


At six o'clock the wall clock struck 6 times . Checking with my watch , I noticed that the time between the first & last strokes was 30 seconds . How long will the clock take to stike 12 at mid night

1043


Mr. Sohan works for Azania Company. The company grants 1000 shares to Mr. Sohan in 2008. At that point each share is worth Rs. 100. In 2010, he decides to sell his entire stake and at that point, the value is Rs. 120 per share. The government declares that the tax to be paid is 10% of the entire profit. Due to the inflation, the value of a rupee in 2010 is equivalent to 0.8 of a rupee in 2008. In this situation, which of the following model indicates the actual tax to be paid by the investor?

750


sir am writing aso(assistant statistical officer) exam first time, so please send me previous papers, and syllabus. my optional subject is statistics

1680


A boy multiplied a number with 10 and got 100,instead of dividing it . If he divided it what would be the answer?

988


Find the distance when they meet from starting point.

719


the decimal number was given.it was converted to other system.they asked to identify the system.i.e. octal,hexadecimal.

654


The mean of 100 bags was found to be 30. What will be the correct mean if at the time of calculation two bags were wrongly taken as 32 and 12 instead of 23 and 11?

874


Asian paints takes a contracts to paint 3 houses. Mr. White can paint a house in 6 days while Mr.Blue would take 8 days and Mr.Red 12 days. After 8 days Mr.White goes on a holiday and Mr. Blue begins to work for a period of 6 days. How many days will it take Mr.Red to complete the work?

711