26 lines
351 B
Plaintext
26 lines
351 B
Plaintext
extern void object::Solution( )
|
|
{
|
|
while ( true )
|
|
{
|
|
object spot;
|
|
float dir;
|
|
|
|
spot = radar(WayPoint);
|
|
if ( spot == null ) // no more ?
|
|
{
|
|
motor(0, 0); // stops
|
|
break;
|
|
}
|
|
|
|
dir = direction(spot.position);
|
|
if ( dir < 0 ) // on the right ?
|
|
{
|
|
motor(1, 1+dir/90);
|
|
}
|
|
else // on the left ?
|
|
{
|
|
motor(1-dir/90, 1);
|
|
}
|
|
}
|
|
}
|