void Grader::catchObj(Obj obj)

{float dist,ang;

   do

     {

      execute

       {

         if(exist(obj)&&obj->_free)

           {

            cartToPol(dist,ang,obj->getX()-getX(),obj->getY()-getY());

            if(dist<=_step)

          {

        _obj=obj;

        _obj->_free=false;

        Ghost ghost = new Ghost(_obj,_ground);

        ghost->setLocation(_obj->getX(),_obj->getY(),0);

        ghost->attachTo(_ground);

        _obj->location=location;

        _obj->attachTo(this);

        _obj->_ghost=ghost;

        _monAutomat->_m1->_memory=1;

        if(_sonde)

          {

            _god->_output2->writeString(format("\t","P"));

            print("P");

            _god->_output2->writeString(format("\t","(",

                _monAutomat->_m1->_memory,_monAutomat->_m2->_memory,")","\n"));

            print("(",_monAutomat->_m1->_memory,_monAutomat->_m2->_memory,")");

          }

        return;   

          }

            }

         else  return;

       }

     setTheta(ang);

     yield();

     } while(true);

}

void Grader::dropObjNear(Obj obj)

{

float dist,ang;

do

  {

  execute

    {

    if(exist(obj)&&obj->_free)

      {

      cartToPol(dist,ang,obj->getX()-getX(),obj->getY()-getY());

      if(dist<=_step/2)

        {

        _obj->setLocation(obj->getX(),obj->getY(),obj->getTheta());

        _obj->attachTo(_ground);

        _obj->_free=true;

        delete(_obj->_ghost);

        _obj->_ghost=(Ghost)NONE;

        _obj=(Obj)NONE;

    _monAutomat->_m1->_memory=0;

    if(_sonde)

          {

            _god->_output2->writeString(format("\t","O"));

            print("O");

            _god->_output2->writeString(format("\t","(",

            _monAutomat->_m1->_memory,_monAutomat->_m2->_memory,")","\n"));

            print("(",_monAutomat->_m1->_memory,_monAutomat->_m2->_memory,")");

          }

        return;   

        }

      }

    else return;}

  setTheta(ang);

  yield();

  } while(true);

}


void Grader::main(void)

{

while(!_obj) catchObj(lookForObj("Obj"));

while(_obj) dropObjNear(lookForObj(_obj->className()));

}

3,141 5926 5358 9793 2384 6264 3383 2795 0288 4197 1693 9937 5105 8209 7494 4592
3078 1640 6286 2089 9862 8034 8253 4211 7067 9821 4808 6513 2823 0664 7093 8446
0955 0582 2317 2535 9408 1284 8111 7450 2841 0270 1938 5211 0555 9644 6229 4895
4930 3819 6442 8810 9756 6593 3446 1284 7564 8233 7867 8316 5271 2019 0914 5648
5669 2346 0348 6104 5432 6648 2133 9360 7260 2491 4127 3724 5870 0660 6315 5881
7488 1520 9209 6282 9254 0917 1536 4367 8925 9036 0011 3305 3054 8820 4665 2138
4146 9519 4151 1609 4330 5727 0365 7595 9195 3092 1861 1738 1932 6117 9310 5118
5480 7446 2379 9627 4956 7351 8857 5272 4891 2279 3818 3011 9491 2983 3673 3624 
4065 6643 0860 2139 4946 3952 2473 7190 7021 7986 0943 7027 7053 9217 1762 9317
6752 3846 7481 8467 6694 0513 2000 5681 2714 5263 5608 2778 5771 3427 5778 9609

1736 3717 8721 4684 4090 1224 9534 3014 6549 5853 7105 0792 2796 8925 8923 5420
1995 6112 1290 2196 0864 0344 1815 9813 6297 7477 1309 9605 1870 7211 3499 9999
8372 9780 4995 1059 7317 3281 6096 3185 9502 4459 4553 4690 8302 6425 2230 8253
3446 8503 5261 9311 8817 1010 0031 3783 8752 8865 8753 3208 3814 2061 7177 6691
4730 3598 2534 9042 8755 4687 3115 9562 8638 8235 3787 5937 5195 7781 8577 8053
2171 2268 0661 3001 9278 7661 1195 9092 1642 0198 9380 9525 7201 0654 8586 3278
8659 3615 3381 8279 6823 0301 9520 3530 1852 9689 9577 3622 5994 1389 1249 7217
7528 3479 1315 1557 4857 2424 5415 0695 9508 2953 3116 8617 2785 5889 0750 9838 
1754 6374 6493 9319 2550 6040 0927 7016 7113 9009 8488 2401
eXo
eXo  maKina

Technologies Informatiques