Thank you guys for your promt answers. Here is the code I ended up with
But I have yet another question .
I have a task to find a black box. So, is there any way to check whether it is possible for a bot to get to the box and return back to the base?
Here is code I wrote.
My solution is to check energy level of the bot. If it is fully charged then the bot flies there. It works well on this level, but it is not perfect.
Code:
extern void object::Transmutation()
{
object [] list;
object alchemist;
list = radarall (TitaniumOre);
message ("Found " + sizeof(list) + " piece(s) of titanium ore");
for(int i=0; i<sizeof(list); i++)
{
object item = list[i];
goto(item.position);
grab();
alchemist = radar(Converter);
goto(alchemist.position);
drop ();
move (-2.5);
wait (8);
while (alchemist.busy ())
{
wait (1);
}
move (2.5);
grab ();
goto (space());
drop ();
}
message ("The task is completed");
}
I have a task to find a black box. So, is there any way to check whether it is possible for a bot to get to the box and return back to the base?
Here is code I wrote.
Code:
extern void object::New()
{
if (this.energyCell.energyLevel == 1)
{
object questitem;
object home;
questitem = radar (BlackBox);
home = radar (SpaceShip);
goto (questitem.position);
grab ();
goto (home.position);
drop ();
}
else {
message ("I can't");
}
}