/usr/share/games/colobot/ai/tfollow1.txt is in colobot-common 0.1.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | extern void object::Example( )
{
while ( true )
{
object target;
float dir, len;
target = radar(TargetBot);
if ( target == null )
{
motor(0, 0); // stop
break;
}
len = distance(position, target.position);
if ( len < 5 ) // too close ?
{
motor(len/5-1, len/5-1); // move backward
}
else
{
dir = direction(target.position);
if ( dir < 0 ) // on the right ?
{
motor(1, 1+dir/90);
}
else // on the left ?
{
motor(1-dir/90, 1);
}
}
}
}
|