extern void object::CollectTitanium3() { // 1) Variable definition. object item; // info. about objects while (true) // always repeats { // 2) Goes toward the titanium ore and grabs it. item = radar(TitaniumOre);// looks for titanium ore goto(item.position); // goes to the position grab(); // grabs the titanium // 3) Goes toward the converter and drops it. item = radar(Converter); // looks for converter goto(item.position); // goes to the position drop(); // drops the titanium move(-2.5); // steps back 2.5 m // 4) Waits until titanium converted and grabs do { wait(1); // waits for cube item = radar(Titanium, 0, 45, 0, 5); } while ( item == null ); goto(item.position); grab(); // prend le cube // 5) Drop on a free space goto(space(position)); // goes to free space drop(); // drops titanium // 6) If power cell half empty, recharges. if ( energyCell.energyLevel < 0.5 ) { // if so: item = radar(PowerStation); if ( item != null ) // found station ? { goto(item.position); // goes there while ( energyCell.energyLevel < 1 ) { // until recharged: wait(1); // waits } } } } }