Same prog for both the robots: *Label1 : Go left*
* Skip next if oil in my path* * Go to Label1* *Label2 : Go left* * Go left* * Go to Label2* Both robots go left with speed one move per 3 second. After one of them finds an oil spot in its way, it doubles its speed to 2 moves per 3 second. Hence, eventually both the robots will clash. Cheers Nikhil Jindal http://www.fundoonick.blogspot.com/ On Thu, Feb 17, 2011 at 12:23 AM, bittu <shashank7andr...@gmail.com> wrote: > 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. > > You must program each robot to ensure that the robots will eventually > crash into each other. A program can consist of the following four > instructions: > > * 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.] > > A robot will carry out one instruction per second. Both robots need > not have the same program. Note that you won't know ahead of time > which robot is on the left and which is on the right. > > Thanks & Regards > Shashank Mani > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > Please access the attached hyperlink for an important electronic communications disclaimer: http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.