Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't make the programm find 4 items
#5
Thank you guys for your promt answers. Here is the code I ended up with

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");
}
But I have yet another question Angel .
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");
    }
}
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.


Messages In This Thread
RE: Can't make the programm find 4 items - by Caroling - 07-15-2017, 04:40 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)