/usr/share/games/colobot/ai/ttrap1.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 42 43 44 45 46 47 48 | extern void object::Example( )
{
while ( true )
{
object spot;
float bomb, dir;
spot = radar(Mine, 0, 180, 0, 5);
if ( spot == null )
{
bomb = 0;
}
else
{
bomb = direction(spot.position);
if ( bomb < 0 )
{
bomb = bomb+180;
}
else
{
bomb = bomb-180;
}
}
spot = radar(WayPoint, 0, 360, 0, 100);
if ( spot == null ) // plus rien ?
{
motor(0, 0); // stoppe
break;
}
dir = direction(spot.position);
if ( bomb != 0 )
{
dir = (dir+bomb)/2;
}
if ( dir < 0 ) // à droite ?
{
motor(1, 1+dir/90);
}
else // à gauche ?
{
motor(1-dir/90, 1);
}
}
}
|