\b;Exercise
Convert some \l;titanium ore\u object\titanore; to \l;titanium cubes\u object\titan;, then drop 2 titanium cubes on the pads whose coordinates are:
\c;
	x=10, y=-60
	x=10, y=-65
\n;
\image derrick 8 8;
The \l;derrick\u object\derrick; extracts titanium ore from the subsoil; you just have to pick it up.

\image convert 8 8;
The \l;converter\u object\convert; converts titanium ore to titanium cubes. Just drop the titanium ore on the platform, move backward, and wait until it has been converted.

\b;General principle
Repeat two times :
o  Wait until there is some titanium ore.
o  Go to the titanium ore.
o  Pick it up.
o  Go to converter.
o  Drop the titanium ore.
o  Move back 2.5 meters.
o  Wait until there is a titanium cube.
o  Pick up the titanium cube.
o  Go to the platform.
o  Drop the titanium cube.

\b;The program
A \c;\l;for\u cbot\for;\n; loop allows you to repeat 2 times all the instructions.
The titanium ore is not available immediately. You will have to wait until the derrick extracts it. Use a \c;\l;do\u cbot\do;\n; loop, as follows:
\c;
\s;do
\s;{
\s;	obj = radar(TitaniumOre);
\s;}
\s;while ( obj == null );
\n;
After the loop (when the radar has found one titanium ore), you can go to its location \c;obj.position\n; with the instruction \c;\l;goto\u cbot\goto;\n;. Use the instruction \c;\l;grab\u cbot\grab;\n; to grab the titanium ore.
Use the following instruction in order to find the converter:
\c;
\s;obj = radar(Converter);
\n;
After you dropped the ore on the converter, move back 2.5 meters with \c;\l;move\u cbot\move;(-2.5)\n;.
A second \c;do\n; loop allows you to wait until the titanium cube is available. You must limit the range of the radar to 5m, otherwise you would immediately find the titanium cube that you already dropped on a pad:
\c;
\s;do
\s;{
\s;	obj = radar(Titanium, 0, 360, 0, 5);
\s;}
\s;while ( obj == null );
\n;
The \c;x\n; coordinates of the 2 pads are all equal to 10. The \c;y\n; coordinates are respectively -60 and -65. The most efficient way to get the coordinates of the pads is to use the value of \c;i\n; of the \c;for\n; loop that will take successively the values 0 and 1:
\c;
\s;dest.x = 10;
\s;dest.y = -60-5*i;
\n;
It is up to you to finish the program...

\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
