The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.1 (Linux)
File Line Function
/showthread.php 906 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't make the programm find 4 items
#1
Hi,
I have a problem, I'm stuck on the first mission of the second level of the game, specifically I have problems with one particular task, which is to make my winged bot to find 4 pieces of titaium ore, it only finds 1 piece of the ore and then proceeds to find the the same piece of ore instead of going for another one.
So, the question is, how to make the bot to find all  4 pieces needed to complete the task (through class system by adding to the found object a specific characteristic or something)

Here is the code I wrote.

Code:
extern void object::New()
{
    object rdr;
    int counter = 0;
    float range = 0;
    
    do
    {
        rdr = radar(TitaniumOre, 0, 360, range);
        if (rdr != null)
        {
            goto (rdr.position);
            grab ();
            object home;
            home = radar(SpaceShip);
            goto (space (home.position));
            drop ();
            counter = counter + 1;
            message(counter);
        }
        else
        {
            message ("Titanium not found");
            goto(rdr.position);
            rdr = radar(TitaniumOre, 0, 360, range++);
        }
    }
    while (counter < 5);
}
 P.S sorry for bad english.


Messages In This Thread
Can't make the programm find 4 items - by Caroling - 07-09-2017, 08:06 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)