\b;Programmation - le langage CBOT
Le langage CBOT est très proche du C++ et du Java. Il a adapté à COLOBOT, et également adapté à une approche pédagogique simple.
Ce langage est constitué d'instructions, de \l;blocs\u cbot\bloc;, de \l;fonctions\u cbot\function;, de \l;classes\u cbot\class;, de \l;variables\u cbot\var;, de \l;tableaux\u cbot\array;, d'\l;expressions\u cbot\expr; et de \l;conditions\u cbot\cond;.

\l;o\u cheats;  \c;\token;Instruction \norm;\n;
Dans l'éditeur de programmes, une instruction du language CBOT est toujours représentée ainsi: \token;instruction\norm;. Si une instruction n'est pas surlignée, elle a nécessairement été mal écrite. Les instructions sont toujours écrites en minuscules.

o  \c;\type;Type\norm;\n;
Le \l;type\u cbot\type; d'une variable apparaît ainsi: \type;type\norm;.

o  \c;\const;Constantes\norm;\n;
Les constantes telles que les \l;catégories\u cbot\category; sont affichées ainsi: \const;constante\norm;. 

\t;Instructions générales du langage:
\c;\l;extern\u cbot\extern;     \n;Indique la fonction principale
\c;\l;if\u cbot\if;         \n;Branchement
\c;\l;else\u cbot\if;       \n;Branchement alternatif
\c;\l;switch\u cbot\switch;     \n;Choix multiples
\c;\l;case\u cbot\switch;       \n;Un choix
\c;\l;default\u cbot\switch;    \n;Choix par défaut
\c;\l;for\u cbot\for;        \n;Structure de boucle
\c;\l;while\u cbot\while;      \n;Structure de contrôle
\c;\l;do\u cbot\do;         \n;Structure de contrôle
\c;\l;break\u cbot\break;      \n;Sortie de boucle
\c;\l;continue\u cbot\continue;   \n;Continuer la boucle
\c;\l;return\u cbot\return;     \n;Fin de la fonction
\c;\l;sizeof\u cbot\sizeof;     \n;Taille d'un tableau

\t;Instructions pour les robots:
\c;\l;detect\u cbot\detect;     \n;Simple object detection
\c;\l;radar\u cbot\radar;      \n;Advanced object detection
\c;\l;radarall\u cbot\radarall;   \n;Advanced multiple objects detection
\c;\l;search\u cbot\search;     \n;Object detection from a specific point
\c;\l;direction\u cbot\direct;  \n;Calculates a rotation angle
\c;\l;distance\u cbot\dist;   \n;Calculates a distance
\c;\l;distance2d\u cbot\dist2d; \n;Calculates a distance
\c;\l;wait\u cbot\wait;       \n;Waits
\c;\l;move\u cbot\move;       \n;Moves forward or backward
\c;\l;turn\u cbot\turn;       \n;Turns
\c;\l;goto\u cbot\goto;       \n;Goes to a given position
\c;\l;motor\u cbot\motor;      \n;Direct motor control
\c;\l;jet\u cbot\jet;        \n;Direct jet engine control
\c;\l;message\u cbot\message;    \n;Displays a message
\c;\l;retobject\u cbot\retobj;  \n;Returns an object from a function
\c;\l;errmode\u cbot\errmode;    \n;Error treatement control
\c;\l;abstime\u cbot\abstime;    \n;Returns the absolute time
\c;\l;pendown\u cbot\pendown;    \n;Starts drawing
\c;\l;penup\u cbot\penup;      \n;Stops drawing
\c;\l;pencolor\u cbot\pencolor;   \n;Changes the pen color
\c;\l;penwidth\u cbot\penwidth;   \n;Changes the pen width
\c;\l;canresearch\u cbot\canresearch; \n;Checks if a technology can be researched
\c;\l;researched\u cbot\researched; \n;Checks if a technology is researched

\t;Instructions sur le terrain:
\c;\l;space\u cbot\space;      \n;Calculates a free space
\c;\l;flatspace\u cbot\flatspace;  \n;Calculates a free, flat space
\c;\l;topo\u cbot\topo;       \n;Returns the altitude of a point
\c;\l;flatground\u cbot\flatgrnd; \n;Returns radius of a flat area

\t;Instructions spécifiques à certains robots:
\c;\l;grab\u cbot\grab;       \n;Picks up an object
\c;\l;drop\u cbot\drop;       \n;Puts down an object
\c;\l;sniff\u cbot\sniff;      \n;Sounds the subsoil
\c;\l;thump\u cbot\thump;      \n;Overturns alien insects
\c;\l;recycle\u cbot\recycle;    \n;Recycles a derelict bot
\c;\l;shield\u cbot\shield;     \n;Extends or withdraws the shield
\c;\l;fire\u cbot\fire;       \n;Fires the cannon
\c;\l;aim\u cbot\aim;        \n;Rotates the cannon
\c;\l;build\u cbot\build;      \n;Builds a building
\c;\l;canbuild\u cbot\canbuild;   \n;Checks if a building can be built
\c;\l;buildingenabled\u cbot\buildingenabled; \n;Checks if a building can be built in the level

\t; 
\c;\l;factory\u cbot\factory;    \n;Starts construction of a bot
\c;\l;research\u cbot\research;   \n;Starts a research
\c;\l;takeoff\u cbot\takeoff;    \n;Takes off a spaceship
\c;\l;busy\u cbot\busy;       \n;Checks if object is busy

\t;Instructions pour les bornes d'information:
\c;\l;receive\u cbot\receive;    \n;Reçoit une information
\c;\l;send\u cbot\send;       \n;Envoie une information
\c;\l;testinfo\u cbot\testinfo;   \n;Teste la présence d'une information
\c;\l;deleteinfo\u cbot\delinfo; \n;Supprime une information

\t;Instructions pour les classes:
\c;\l;class\u cbot\class;      \n;Class declararion
\c;\l;public\u cbot\public;     \n;Declares a public class member
\c;\l;private\u cbot\private;    \n;Declares a private class member
\c;\l;protected\u cbot\protected;  \n;Declares a protected class member
\c;\l;static\u cbot\static;     \n;Declares a static class member
\c;\l;synchronized\u cbot\synchro; \n;Prevents simultaneous execution
\c;\l;new\u cbot\new;        \n;Creates a new instance
\c;\l;this\u cbot\this;       \n;Reference to the current instance
\c;\l;extends\u cbot\extends;    \n;Extends a class
\c;\l;super\u cbot\super;      \n;Grants access to the parent class

\t;Instructions pour les chaînes de caractères:
\c;\l;strlen\u cbot\strlen;     \n;Longueur d'une chaîne.
\c;\l;strleft\u cbot\strleft;    \n;Extrait la partie gauche.
\c;\l;strright\u cbot\strright;   \n;Extrait la partie droite.
\c;\l;strmid\u cbot\strmid;     \n;Extrait la partie centrale.
\c;\l;strfind\u cbot\strfind;    \n;Cherche une sous-chaîne.
\c;\l;strval\u cbot\strval;     \n;Convertit en un nombre.
\c;\l;strupper\u cbot\strupper;   \n;Convertit en majuscules.
\c;\l;strlower\u cbot\strlower;   \n;Convertit en minuscules.

\t;Instructions pour les fichiers:
\c;\l;open\u cbot\open;       \n;Ouvre un fichier
\c;\l;close\u cbot\close;      \n;Ferme un fichier
\c;\l;writeln\u cbot\writeln;    \n;Ecrit une ligne
\c;\l;readln\u cbot\readln;     \n;Lit une ligne
\c;\l;eof\u cbot\eof;        \n;Teste la fin du fichier
\c;\l;deletefile\u cbot\deletef; \n;Supprime un fichier

\t;Fonctions mathématiques:
\c;\l;rand\u cbot\rand;       \n;Returns a random value
\c;\l;pow\u cbot\pow;        \n;Returns a power
\c;\l;sqrt\u cbot\sqrt;       \n;Returns a square root
\c;\l;floor\u cbot\floor;      \n;Returns the largest previous integer
\c;\l;ceil\u cbot\ceil;       \n;Returns the smallest following integer
\c;\l;round\u cbot\round;      \n;Returns a rounded number
\c;\l;trunc\u cbot\trunc;      \n;Returns a truncated number
\c;\l;sin\u cbot\sin;        \n;Returns a sine
\c;\l;cos\u cbot\cos;        \n;Returns a cosine
\c;\l;tan\u cbot\tan;        \n;Returns a tangent
\c;\l;asin\u cbot\asin;       \n;Returns an arcus sine
\c;\l;acos\u cbot\acos;       \n;Returns an arcus cosine
\c;\l;atan\u cbot\atan;       \n;Returns an arcus tangent
\c;\l;atan2\u cbot\atan2;      \n;Returns an arcus tangent, has two arguments

\t;Voir aussi
\l;Types\u cbot\type; et \l;catégories\u cbot\category;.
