/usr/share/games/colobot/ai/ttrap2.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 34 35 36 37 38 39 40 41 | extern void object::Example( )
{
while ( true )
{
object spot;
float dir;
spot = radar(Mine, 0, 180, 0, 3.5);
if ( spot == null )
{
spot = radar(WayPoint, 0, 360);
if ( spot == null ) // plus rien ?
{
motor(0, 0); // stoppe
break;
}
dir = direction(spot.position);
}
else
{
dir = direction(spot.position);
if ( dir < 0 )
{
dir = dir+180;
}
else
{
dir = dir-180;
}
}
if ( dir < 0 ) // à droite ?
{
motor(1, 1+dir/90);
}
else // à gauche ?
{
motor(1-dir/90, 1);
}
}
}
|