Import the correct french data files

dev-ui
Didier 'OdyX' Raboud 2013-10-10 16:10:20 +02:00 committed by Piotr Dziwinski
parent 6cf650d482
commit a476433507
275 changed files with 4091 additions and 3990 deletions

View File

@ -1,7 +1,6 @@
Development team: Beta tester core team: Equipe de développement: Beta testeurs:
- Daniel Roux - Adrien Roux - Michael Jubin - Daniel Roux - Adrien Roux - Michael Jubin
- Denis Dumoulin - Didier Raboud - Daniel Sauthier - Denis Dumoulin - Didier Raboud - Daniel Sauthier
- Otto Kölbl - Nicolas Beuchat - Nicolas Stubi - Otto Kölbl - Nicolas Beuchat - Nicolas Stubi
- Michael Walz - Joël Roux - Patrick Thévoz - Michael Walz - Patrick Thévoz
- Didier Gertsch

View File

@ -1,91 +1,100 @@
\b;Programming - the CBOT language \b;Programmation - le langage CBOT
The CBOT language is very close in structure and syntax to C++ and Java. It has been adapted for the specific purposes of COLOBOT, and for an efficient pedagogical approach. Le langage CBOT est très proche du C++ et du Java. Il est adapté à COLOBOT, et également adapté à une approche pédagogique simple.
This language is made up of instructions (see below), \l;blocks\u cbot\bloc;, \l;functions\u cbot\function;, \l;classes\u cbot\class;, \l;variables\u cbot\var;, \l;arrays\u cbot\array;, \l;expressions\u cbot\expr; and \l;conditions\u cbot\cond;. 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;.
o \c;\token;Instructions\norm;\n; o \c;\token;Instruction\norm;\n;
In the program editor, an instruction in the CBOT language is always displayed on an orange background. If an instruction hasn't got an orange background, this means that it has been misspelled. Instruction names are always written in lower case. Dans l'éditeur de programmes, une instruction du langage est coloriée en orange. Si une instruction n'est pas coloriée, c'est que son nom est mal orthographié. Il faut par exemple frapper tout le nom en minuscules.
o \c;\type;Type\norm;\n; o \c;\type;Type\norm;\n;
The \l;type\u cbot\type; of a variable appears with a green background. Le \l;type\u cbot\type; d'une variable est colorié en vert.
o \c;\const;Constants\norm;\n; o \c;\const;Constante\norm;\n;
Constants like \l;categories\u cbot\category; are displayed with a red background. Une constante telle qu'une \l;catégorie\u cbot\category; est coloriée en rouge.
\t;Instructions in the CBOT language: \t;Instructions générales du langage:
\c;\l;extern\u cbot\extern; \n;Indicate the main function \c;\l;extern\u cbot\extern; \n;Indique le programme principal
\c;\l;if\u cbot\if; \n;Choice structure \c;\l;if\u cbot\if; \n;Structure de choix
\c;\l;else\u cbot\if; \n;Alternative choice structure \c;\l;else\u cbot\if; \n;Structure de choix
\c;\l;for\u cbot\for; \n;Loop structure \c;\l;repeat\u cbot\repeat; \n;Structure de répétition
\c;\l;while\u cbot\while; \n;Control structure \c;\l;for\u cbot\for; \n;Structure de répétition
\c;\l;do\u cbot\do; \n;Control structure \c;\l;while\u cbot\while; \n;Stucture de contrôle
\c;\l;break\u cbot\break; \n;Exit from a loop \c;\l;do\u cbot\do; \n;Stucture de contrôle
\c;\l;continue\u cbot\continue; \n;Continues the loop \c;\l;break\u cbot\break; \n;Sortie d'un boucle
\c;\l;return\u cbot\return; \n;Exit from a function \c;\l;continue\u cbot\continue; \n;Continue une boucle
\c;\l;sizeof\u cbot\sizeof; \n;Size of an array \c;\l;return\u cbot\return; \n;Sort d'une fonction
\c;\l;sizeof\u cbot\sizeof; \n;Taille d'un tableau
\t;Specific instructions for bots: \t;Instructions pour les robots:
\c;\l;radar\u cbot\radar; \n;Object detection \c;\l;find\u cbot\find; \n;Va vers un objet
\c;\l;direction\u cbot\direct; \n;Calculates a rotation angle \c;\l;detect\u cbot\detect; \n;Détection simple d'objets
\c;\l;distance\u cbot\dist; \n;Calculates a distance \c;\l;radar\u cbot\radar; \n;Détection généralisée d'objets
\c;\l;distance2d\u cbot\dist2d; \n;Calculates a distance \c;\l;direction\u cbot\direct; \n;Calcule une direction
\c;\l;wait\u cbot\wait; \n;Waits \c;\l;distance\u cbot\dist; \n;Calcule une distance
\c;\l;move\u cbot\move; \n;Moves forward or backward \c;\l;distance2d\u cbot\dist2d; \n;Calcule une distance "à plat"
\c;\l;turn\u cbot\turn; \n;Turns \c;\l;wait\u cbot\wait; \n;Attend
\c;\l;goto\u cbot\goto; \n;Goes to a given position \c;\l;move\u cbot\move; \n;Avance ou recule
\c;\l;motor\u cbot\motor; \n;Direct motor control \c;\l;turn\u cbot\turn; \n;Tourne
\c;\l;jet\u cbot\jet; \n;Direct jet engine control \c;\l;goto\u cbot\goto; \n;Va à une position donnée
\c;\l;message\u cbot\message; \n;Displays a message \c;\l;motor\u cbot\motor; \n;Commande directe des moteurs
\c;\l;retobject\u cbot\retobj; \n;Returns an object from a function \c;\l;jet\u cbot\jet; \n;Commande directe du réacteur
\c;\l;errmode\u cbot\errmode; \n;Error treatement control \c;\l;message\u cbot\message; \n;Affiche un message
\c;\l;abstime\u cbot\abstime; \n;Returns the absolute time \c;\l;retobject\u cbot\retobj; \n;Retourne un objet
\c;\l;errmode\u cbot\errmode; \n;Mode de gestion des erreurs
\c;\l;abstime\u cbot\abstime; \n;Retourne le temps absolu
\t;Instructions about topology: \t;Instructions pour dessiner:
\c;\l;space\u cbot\space; \n;Calculates a free space \c;\l;pendown\u cbot\pendown; \n;Abaisse le crayon du robot
\c;\l;topo\u cbot\topo; \n;Returns the altitude of a point \c;\l;penup\u cbot\penup; \n;Relève le crayon du robot
\c;\l;flatground\u cbot\flatgrnd; \n;Returns radius of a flat area \c;\l;pencolor\u cbot\pencolor; \n;Choix de la couleur
\c;\l;penwidth\u cbot\penwidth; \n;Choix de l'épaisseur du trait
\t;Instructions specific to some bots: \t;Instructions sur le terrain:
\c;\l;grab\u cbot\grab; \n;Picks up an object \c;\l;space\u cbot\space; \n;Calcule une position libre
\c;\l;drop\u cbot\drop; \n;Puts down an object \c;\l;topo\u cbot\topo; \n;Retourne l'élévation d'un point
\c;\l;sniff\u cbot\sniff; \n;Sounds the subsoil \c;\l;flatground\u cbot\flatgrnd; \n;Retourne le rayon d'une zone plate
\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;Vertical angle of the cannon
\t;Specific instructions for exchange posts: \t;Instructions spécifiques à certains robots:
\c;\l;receive\u cbot\receive; \n;Receives an information \c;\l;grab\u cbot\grab; \n;Prend un objet
\c;\l;send\u cbot\send; \n;Sends a new information \c;\l;drop\u cbot\drop; \n;Dépose un objet
\c;\l;testinfo\u cbot\testinfo; \n;Tests if an information exists \c;\l;sniff\u cbot\sniff; \n;Sonde le sous-sol
\c;\l;deleteinfo\u cbot\delinfo; \n;Deletes an existing information \c;\l;thump\u cbot\thump; \n;Secoue
\c;\l;recycle\u cbot\recycle; \n;Recycle une épave
\c;\l;shield\u cbot\shield; \n;Déploie le bouclier
\c;\l;fire\u cbot\fire; \n;Fait feu avec le canon
\c;\l;aim\u cbot\aim; \n;Hausse du canon
\t;Specific instructions for classes: \t;Instructions pour les bornes d'infomation:
\c;\l;class\u cbot\class; \n;Class declararion \c;\l;receive\u cbot\receive; \n;Reçoit une information
\c;\l;public\u cbot\public; \n;Declares a public function \c;\l;send\u cbot\send; \n;Envoie une information
\c;\l;private\u cbot\private; \n;Declares a private class member \c;\l;testinfo\u cbot\testinfo; \n;Teste la présence d'une information
\c;\l;static\u cbot\static; \n;Declares a static class member \c;\l;deleteinfo\u cbot\delinfo; \n;Supprime une information
\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
\t;Specific instructions for strings: \t;Instructions pour les classes:
\c;\l;strlen\u cbot\strlen; \n;Gets string length \c;\l;class\u cbot\class; \n;Déclaration d'une classe
\c;\l;strleft\u cbot\strleft; \n;Extracts left part \c;\l;public\u cbot\public; \n;Indique une fonction publique
\c;\l;strright\u cbot\strright; \n;Extracts right part \c;\l;private\u cbot\private; \n;Indique un champ privée dans une classe
\c;\l;strmid\u cbot\strmid; \n;Extracts center part \c;\l;static\u cbot\static; \n;Indique un champ statique dans une classe
\c;\l;strfind\u cbot\strfind; \n;Finds a substring. \c;\l;synchronized\u cbot\synchro; \n;Empêche l'exécution simultanée
\c;\l;strval\u cbot\strval; \n;Converts string to number \c;\l;new\u cbot\new; \n;Crée une nouvelle instance
\c;\l;strupper\u cbot\strupper; \n;Converts to upper case \c;\l;this\u cbot\this; \n;Référence l'instance courante
\c;\l;strlower\u cbot\strlower; \n;Converts to lower case
\t;Specific instructions for files: \t;Instructions pour les chaînes de caractères:
\c;\l;open\u cbot\open; \n;Opens a file \c;\l;strlen\u cbot\strlen; \n;Longueur d'une chaîne.
\c;\l;close\u cbot\close; \n;Closes a file \c;\l;strleft\u cbot\strleft; \n;Extrait la partie gauche.
\c;\l;writeln\u cbot\writeln; \n;Writes line to a file \c;\l;strright\u cbot\strright; \n;Extrait la partie droite.
\c;\l;readln\u cbot\readln; \n;Reads line from a file \c;\l;strmid\u cbot\strmid; \n;Extrait la partie centrale.
\c;\l;eof\u cbot\eof; \n;Tests if end of file \c;\l;strfind\u cbot\strfind; \n;Cherche une sous-chaîne.
\c;\l;deletefile\u cbot\deletef; \n;Deletes a file \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;See also \t;Instructions pour les fichiers:
\l;Types\u cbot\type; and \l;categories\u cbot\category;. \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;Voir aussi
\l;Types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,11 +1,14 @@
\b;Instruction \c;abstime\n; \b;Instruction \c;abstime\n;
Syntax¦: Syntaxe:
\s;\c;abstime ( );\n; \s;\c;abstime ( );\n;
Return the time in seconds elapsed since the beginning of the mission. Retourne le temps absolu depuis lequel la partie est commencée.
\t;Return: \c;\l;float\u cbot\float;\n; \t;Valeur retournée: \c;\l;float\u cbot\float;\n;
Time in seconds. Temps en secondes.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;time\n; = temps
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,21 +1,24 @@
\b;Instruction \c;aim\n; \b;Instruction \c;aim\n;
Syntax : Syntaxe:
\s;\c;aim ( angle );\n; \s;\c;aim ( angle );\n;
This instruction sets the vertical angle of the cannon. The following robots are equipped with a cannon: Hausse du canon, pour les robots équipés d'un canon, à savoir:
o \l;Shooter\u object\botfr; o \l;Robot shooter\u object\botfr;
o \l;Orga shooter\u object\botor; o \l;Robot orgaShooter\u object\botor;
o \l;Phazer shooter\u object\botphaz; o \l;Robot phazer\u object\botphaz;
When controlling the robot through programming, the only way to turn the gun left or right is to turn the whole robot with the instruction \c;\l;turn\u cbot\turn;\n;. Pour diriger le canon vers la gauche ou vers la droite, le seul moyen est d'orienter le robot avec l'instuction \c;\l;turn\u cbot\turn;\n;.
\t;angle: \c;\l;float\u cbot\float;\n; \t;angle: \c;\l;float\u cbot\float;\n;
Angle in degrees of the gun relative to the robot. A positive value orients the gun upward. For shooters and orga shooters, the angle must range from \c;-20\n; to \c;+20\n; degrees. For phazer shooters, the angle must range from \c;-20\n; to \c;45\n; degrees. Angle en degrés du canon. Un angle positif oriente le canon vers le haut. Pour les robots shooter, la valeur doit être comprise entre \c;-10\n; et \c;+20\n; degrés. Pour les robots orgaShooter, la valeur doit être comprise entre \c;-20\n; et \c;+20\n; degrés. Le robot phazer accepte des valeurs comprises entre \c;-20\n; et \c;45\n; degrés.
\t;Return value: \c;\l;int\u cbot\int;\n; \t;Valeur retournée: \c;\l;int\u cbot\int;\n;
Zero if everything is OK, a value different from zero if the rotation could not be performed: Zéro si tout est ok, ou valeur non nulle si une erreur est intervenue.
\c;== 0 \n;The gun has now got the desired orientation \c;== 0 \n;angle atteint
\c;!= 0 \n;rotation impossible \c;!= 0 \n;rotation impossible
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;aim\n; = viser
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,31 +1,35 @@
\b;Arrays \b;Les tableaux (pour spécialistes)
An array is basically a collection of variables of the same type or class. You can use N dimensionnal arrays in the CBOT language. Each dimension is limited to 9999 elements. You must use square brackets \c;[]\n; after the type name or the variable name to declare an array. CBOT gère des tableaux de N dimensions, mais limités volontairement à un maximum de 9999 éléments par dimension. Les tableaux peuvent être de chaque type de base et même avec des éléments d'une classe quelconque. Pour déclarer un tableau, il faut mettre des crochets \c;[]\n; après le type, ou/et après le nom de la variable déclarée.
\c; \c;
\s;int [ ] a; // an array of int \s;int [ ] a; // un tableau de nombre entier
\s;int a [12]; // an array of int limited to 12 elements \s;int a [12]; // idem limité à 12 éléments
\s;string s[3]; // an array of 3 strings \s;string s[3]; // un tableau de 3 chaînes
\s;float xy[][]; // an 2 dimensionnal array of floats \s;float xy[][]; // un tableau à 2 dimensions
\n; \n;
Actually when the CBOT interpreter encounters an array declaration, it just creates a \c;\l;null\u cbot\null;\n; \l;reference\u cbot\pointer;: En vérité, lors de la déclaration d'un tableau, CBOT attribue juste une \l;référence\u cbot\pointer; nulle initialement:
\c; \c;
\s;int a[5]; // a is now a null reference \s;int a[5]; // a est une référence nulle
\n; \n;
As soon as you put values into the array, the elements are created and the reference is initialized: Dès que l'on met une valeur dans le tableau, CBOT crée les éléments nécessaires et initialise la référence:
\c; \c;
\s;a[2] = 213; // a points to \s;a[2] = 213; // a est une référence sur
\s; // 3 élements [0], [1] et [2] \s; // 3 éléments [0], [1] et [2]
\n; \n;
After this operation, \c;a\n; contains a reference to the elements of the array. Elements \c;[0]\n; and \c;[1]\n; are created but not initialized because an array cannot contain empty elements. The \c;\l;sizeof\u cbot\sizeof;\n; instruction allows you to obtain the number of elements contained in an array. Après cette opération, \c;a\n; contient une référence vers les éléments du tableau. Les éléments \c;[0]\n; et \c;[1]\n; sont créés (non initialisés) car un tableau ne peut pas avoir d'éléments vides.
L'instruction \c;\l;sizeof\u cbot\sizeof;\n; permet de connaître le nombre d'éléments d'un tableau.
When an array is declared with a maximum size, the program will stop as soon as there is an access beyond the maximum array size. No error is signalled during compilation even if the error is obvious: Lorsqu'un tableau est déclaré avec une taille maximale, le programme donne une erreur lors de l'exécution si on essaie de mettre un élément de trop. Aucune erreur n'est signalée lors de la compilation même si l'erreur paraît évidente:
\c; \c;
\s;{ \s;{
\s; int a[5]; \s; int a[5];
\s; a[7] = 123; // no error at compile time \s; a[7] = 123; // pas d'erreur à la compilation
\s; // but error at run time \s; // mais erreur lors de l'exécution
\s;} \s;}
\n; \n;
If you pass an array as parameter to a \l;function\u cbot\function;, the function only receives a \l;reference\u cbot\pointer; to the array. That means if you modify an array element in the function, the element of the array that has been passed the function will be actuallay modified. Lorsqu'on donne un tableau comme paramètre d'une \l;fonction\u cbot\function;, c'est toujours une \l;référence\u cbot\pointer; qui est passée.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;array\n; = tableau
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,23 +1,23 @@
\b;Blocks \b;Les blocs
You can use braces \c;{ }\n; to group a number of instructions together in order to make one single block out of them, for example: Les accolades \c;{ }\n; permettent de grouper plusieurs instructions dans un bloc. Par exemple:
\c; \c;
\s; { \s; {
\s; float t; \s; float t;
\s; t = a; \s; t = a;
\s; a = b; \s; a = b;
\s; b = t; // switches round a and b \s; b = t; // permute a et b
\s; } \s; }
\n; \n;
Every instruction in the block is followed by a \l;semicolon\u cbot\term;, but the block itself is not. Chaque instruction dans le bloc est terminée par un \l;point-virgule\u cbot\term;, mais pas le bloc lui-même.
Let us take the following example with the instruction \c;\l;if\u cbot\if;\n; to illustrate the use of blocks in a program: Considérons l'exemple suivant utilisant l'instruction \c;\l;if\u cbot\if;\n;:
\c; \c;
\s; if ( a < b ) \s; if ( a < b )
\s; \n;instruction 1\c;; \s; \n;instruction 1\c;;
\s; \n;instruction 2\c;; \s; \n;instruction 2\c;;
\s; \n;instruction 3\c;; \s; \n;instruction 3\c;;
\n; \n;
If the \l;condition\u cbot\cond; is true, instructions 1, 2 and 3 are performed. If the condition is false, only instruction 1 is ignored, instructions 2 and 3 are performed. The fact that instruction 2 is lined up with instruction 1 does not matter. Si la \l;condition\u cbot\cond; est vraie, les instructions 1, 2 et 3 sont exécutées. En revanche, si la condition est fausse, seule l'instruction 1 est sautée (on exécute donc les instructions 2 et 3). Le fait que l'instruction 2 soit alignée avec la 1 n'y change rien.
If you want to perform instructions 1 and 2 only if the condition is true, you have to bracket them together in a block: Pour n'exécuter les instructions 1 et 2 que si la condition est vraie, il faut les grouper dans un bloc:
\c; \c;
\s; if ( a < b ) \s; if ( a < b )
\s; { \s; {
@ -26,8 +26,8 @@ If you want to perform instructions 1 and 2 only if the condition is true, you h
\s; } \s; }
\s; \n;instruction 3\c;; \s; \n;instruction 3\c;;
\n; \n;
Blocks may be needed with instructions \c;\l;if\u cbot\if;\n;, \c;\l;while\u cbot\while;\n; and \c;\l;for\u cbot\for;\n;, in order to group several instructions that should be performed only if a condition is true, or repeated several times. Les blocs sont très utilisés avec les instructions \c;\l;if\u cbot\if;\n;, \c;\l;while\u cbot\while;\n; et \c;\l;for\u cbot\for;\n;, pour grouper plusieurs instructions à exécuter ou à répéter.
You can fit blocks into other blocks, on as many levels as you need. Here is an example of imbrication on two levels : On imbrique très souvent des blocs dans d'autres blocs, et ceci à autant de niveaux que nécessaire. Voici un exemple d'imbrication à deux niveaux:
\c; \c;
\s; if ( a > b ) \s; if ( a > b )
\s; { \s; {
@ -40,10 +40,10 @@ You can fit blocks into other blocks, on as many levels as you need. Here is an
\s; } \s; }
\s; } \s; }
\n; \n;
You had better line up the open brace \c;{\n; with the closing brace \c;}\n; in order to improve readability, but it is not compulsory. The following example takes less space, is equivalent to the previous example, but it is not advisable to write your programs in the following style : En général, pour des questions de lisibilité, on aligne verticalement l'accolade ouvrante \c;{\n; avec sa partenaire fermante \c;}\n;. Mais cela n'est pas obligatoire. L'exemple suivant, beaucoup plus compact mais déconseillé, est strictement équivalent à l'exemple précédent:
\c; \c;
\s; if(a>b) { int i=0; while(i<18) { \s; if(a>b) { int i=0; while(i<18) {
\s; move(10);turn(5);i=i+1; }} \s; move(10);turn(5);i=i+1; }}
\n; \n;
\t;See also \t;Voir aussi
\l;Instructions\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,5 +1,11 @@
\b;Type \c;bool\n; \b;Type \c;bool\n;
In a variable of this type you can put a boolean value, that is a value that can take only two states: true or false. Ce type permet de représenter une valeur booléenne, c'est-à-dire une valeur ne pouvant prendre que deux états: vrai ou faux.
\t;See also \s;\c; true \n;vrai
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \s;\c; false \n;faux
\t;Dictionnaire anglais-français
\c;boolean\n; = booléen
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,13 +1,13 @@
\b;Instruction \c;break\n; \b;Instruction \c;break\n;
Syntax : Syntaxe:
\s;\c;while ( condition ) \s;\c;while ( condition )
\s;{ \s;{
\s; break; \s; break;
\s;} \s;}
\n; \n;
With this instruction, you can get out immediately of a \c;\l;while\u cbot\while;\n; or \c;\l;for\u cbot\for;\n; loop. Cette instruction permet de sortir immédiatement d'une structure \c;\l;while\u cbot\while;\n; ou \c;\l;for\u cbot\for;\n;.
Here is an example: Voici un exemple d'utilisation:
\s;\c;int i = 0; \s;\c;int i = 0;
\s;while ( true ) \s;while ( true )
\s;{ \s;{
@ -17,9 +17,10 @@ Here is an example:
\s; { \s; {
\s; break; \s; break;
\s; } \s; }
\s; \n;more instructions ...\c;
\s;} \s;}
\n; \n;
\t;Dictionnaire anglais-français
\c;break\n; = rompre
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,108 +1,106 @@
\b;Value \c;Categories\n; \b;Valeur \c;catégorie\n;
Categories represent the names of objects in the CBOT language. Everything in COLOBOT is an object: robots, buildings, raw materials, etc., even yourself. La catégorie détermine la nature d'un objet. Dans COLOBOT, tout est objet: les robots, les bâtiments, les matières premières, les éléments du décor, etc.
Dans un programme, un nom de catégorie est toujours \const;colorié en rouge\norm;. Si une catégorie n'est pas coloriée, c'est que son nom est mal orthographié. Il faut par exemple respecter les majuscules et les minuscules. Voici les différents types possibles:
In a program, categories are always displayed on a \const;red background\norm;. If a category isn't highlighted in red, it is misspelled. Caps and lower cases should be kept as is. \t;Catégories des bâtiments:
Below are the different categories available : \button 176; \c;\l;Huston\u object\huston; \n;Centre de contrôle
\button 171; \c;\l;SpaceShip\u object\base; \n;Vaisseau spatial
\t;Buildings : \button 163; \c;\l;ResearchCenter\u object\research; \n;Centre de recherches
\button 160; \c;\l;BotFactory\u object\factory; \n;Fabrique de robots
\button 176; \c;\l;Houston\u object\Huston; \n;Mission Control \button 162; \c;\l;Converter\u object\convert; \n;Conversion minerai en titanium
\button 171; \c;\l;SpaceShip\u object\base; \n;Spaceship \button 164; \c;\l;PowerStation\u object\station; \n;Station de recharge
\button 160; \c;\l;BotFactory\u object\factory; \n;Robot Factory
\button 163; \c;\l;ResearchCenter\u object\research; \n;Research Center
\button 168; \c;\l;RadarStation\u object\radar; \n;Radar \button 168; \c;\l;RadarStation\u object\radar; \n;Radar
\button 172; \c;\l;ExchangePost\u object\exchange; \n;Information Exchange Post \button 169; \c;\l;RepairCenter\u object\repair; \n;Centre de réparation
\button 169; \c;\l;RepairCenter\u object\repair; \n;Repair Center \button 165; \c;\l;DefenseTower\u object\tower; \n;Tour de défense
\button 165; \c;\l;DefenseTower\u object\tower; \n;Defense Tower \button 167; \c;\l;PowerPlant\u object\energy; \n;Fabrique de piles
\button 166; \c;\l;AutoLab\u object\labo; \n;Organic Matter Analyzer
\button 164; \c;\l;PowerStation\u object\station; \n;Power Station
\button 167; \c;\l;PowerPlant\u object\energy; \n;Power Cell Factory
\button 170; \c;\l;NuclearPlant\u object\nuclear; \n;Nuclear Plant
\button 162; \c;\l;Converter\u object\convert; \n;Titanium Converter
\button 161; \c;\l;Derrick\u object\derrick; \n;Derrick \button 161; \c;\l;Derrick\u object\derrick; \n;Derrick
\button 174; \c;\l;PowerCaptor\u object\captor; \n;Parabolic Lightning Conductor \button 170; \c;\l;NuclearPlant\u object\nuclear; \n;Centrale nucléaire
\button 175; \c;\l;Vault\u object\safe; \n;Vault \button 166; \c;\l;AutoLab\u object\labo; \n;Analyseur de matières organiques
\c;\l;StartArea\u object\start; \n;Starting Pad \button 174; \c;\l;PowerCaptor\u object\captor; \n;Paratonnerre
\c;\l;GoalArea\u object\goal; \n;Finishing Pad \button 175; \c;\l;Vault\u object\safe; \n;Coffre-fort
\c;\l;AlienNest\u object\nest; \n;Alien Nest \button 172; \c;\l;ExchangePost\u object\exchange; \n;Borne d'informations
\c;\l;StartArea\u object\start; \n;Départ
\c;\l;GoalArea\u object\goal; \n;But
\c;\l;AlienNest\u object\nest; \n;Nid
\t;Portable Objects : \t;Catégories des objets transportables:
\c;\l;TitaniumOre\u object\titanore; \n;Titanium Ore \c;\l;TitaniumOre\u object\titanore; \n;Minerai de titanium
\c;\l;UraniumOre\u object\uranore; \n;Uranium Ore \c;\l;UraniumOre\u object\uranore; \n;Minerai d'uranium
\c;\l;Titanium\u object\titan; \n;Cube of converted Titanium \c;\l;Titanium\u object\titan; \n;Titanium
\c;\l;PowerCell\u object\power; \n;Regular Power Cell \c;\l;PowerCell\u object\power; \n;Pile normale
\c;\l;NuclearCell\u object\atomic; \n;Nuclear Power Cell \c;\l;NuclearCell\u object\atomic; \n;Pile atomique
\c;\l;OrgaMatter\u object\bullet; \n;Organic Matter \c;\l;OrgaMatter\u object\bullet; \n;Matière organique
\c;\l;BlackBox\u object\bbox; \n;Black Box \c;\l;BlackBox\u object\bbox; \n;Boîte noire
\c;\l;TNT\u object\tnt; \n;Explosive device \c;\l;KeyA..D\u object\key; \n;Clés A, B C et D
\c;\l;KeyA..D\u object\key; \n;Keys A, B, C and D \c;\l;TNT\u object\tnt; \n;Caisse d'explosif
\t;Robots : \t;Catégories des robots:
\button 158; \c;\l;PracticeBot\u object\bottr; \n;Practice Bot \button 158; \c;\l;PracticeBot\u object\bottr; \n;Robot d'entraînement
\button 173; \c;\l;TargetBot\u object\bottarg; \n;Target Bot \button 173; \c;\l;TargetBot\u object\bottarg; \n;Robot cible
\button 137; \c;\l;WheeledGrabber\u object\botgr; \n;Wheeled Grabber \button 137; \c;\l;WheeledGrabber\u object\botgr; \n;Robot déménageur
\button 138; \c;\l;TrackedGrabber\u object\botgc; \n;Tracked Grabber \button 138; \c;\l;TrackedGrabber\u object\botgc;\n;
\button 139; \c;\l;WingedGrabber\u object\botgj; \n;Winged Grabber \button 139; \c;\l;WingedGrabber\u object\botgj;\n;
\button 150; \c;\l;LeggedGrabber\u object\botgs; \n;Legged Grabber \button 150; \c;\l;LeggedGrabber\u object\botgs;\n;
\button 140; \c;\l;WheeledSniffer\u object\botsr; \n;Wheeled Sniffer \button 140; \c;\l;WheeledSniffer\u object\botsr; \n;Robot renifleur
\button 141; \c;\l;TrackedSniffer\u object\botsc; \n;Tracked Sniffer \button 141; \c;\l;TrackedSniffer\u object\botsc;\n;
\button 142; \c;\l;WingedSniffer\u object\botsj; \n;Winged Sniffer \button 142; \c;\l;WingedSniffer\u object\botsj;\n;
\button 152; \c;\l;LeggedSniffer\u object\botss; \n;Legged Sniffer \button 152; \c;\l;LeggedSniffer\u object\botss;\n;
\button 143; \c;\l;WheeledShooter\u object\botfr; \n;Wheeled Shooter \button 143; \c;\l;WheeledShooter\u object\botfr; \n;Robot canon shooter
\button 144; \c;\l;TrackedShooter\u object\botfc; \n;Tracked Shooter \button 144; \c;\l;TrackedShooter\u object\botfc;\n;
\button 145; \c;\l;WingedShooter\u object\botfj; \n;Winged Shooter \button 145; \c;\l;WingedShooter\u object\botfj;\n;
\button 151; \c;\l;LeggedShooter\u object\botfs; \n;Legged Shooter \button 151; \c;\l;LeggedShooter\u object\botfs;\n;
\button 153; \c;\l;WheeledOrgaShooter\u object\botor; \n;Wheeled Orga Shooter \button 153; \c;\l;WheeledOrgaShooter\u object\botor; \n;Robot canon orgaShooter
\button 154; \c;\l;TrackedOrgaShooter\u object\botoc; \n;Tracked Orga Shooter \button 154; \c;\l;TrackedOrgaShooter\u object\botoc;\n;
\button 155; \c;\l;WingedOrgaShooter\u object\botoj; \n;Winged Orga Shooter \button 155; \c;\l;WingedOrgaShooter\u object\botoj;\n;
\button 156; \c;\l;LeggedOrgaShooter\u object\botos; \n;Legged Orga Shooter \button 156; \c;\l;LeggedOrgaShooter\u object\botos;\n;
\button 149; \c;\l;Subber\u object\botsub; \n;Subber \button 149; \c;\l;Subber\u object\botsub; \n;Robot sous-marin
\button 148; \c;\l;Recycler\u object\botrecy; \n;Recycler \button 148; \c;\l;Recycler\u object\botrecy; \n;Robot recycleur
\button 157; \c;\l;Shielder\u object\botshld; \n;Shielder \button 146; \c;\l;Thumper\u object\bottump; \n;Robot secoueur
\button 146; \c;\l;Thumper\u object\bottump; \n;Thumper \button 157; \c;\l;Shielder\u object\botshld; \n;Robot bouclier
\button 147; \c;\l;PhazerShooter\u object\botphaz; \n;Phazer Shooter \button 147; \c;\l;PhazerShooter\u object\botphaz; \n;Robot phazer
\t;Enemies : \t;Catégories des ennemis:
\c;\l;AlienQueen\u object\mother; \n;Alien Queen \c;\l;AlienQueen\u object\mother; \n;Mère pondeuse
\c;\l;AlienEgg\u object\egg; \n;Alien Egg \c;\l;AlienEgg\u object\egg; \n;Oeuf
\c;\l;AlienAnt\u object\ant; \n;Ant \c;\l;AlienAnt\u object\ant; \n;Fourmi
\c;\l;AlienSpider\u object\spider; \n;Spider \c;\l;AlienSpider\u object\spider; \n;Araignée
\c;\l;AlienWasp\u object\wasp; \n;Wasp \c;\l;AlienWasp\u object\wasp; \n;Guêpe
\c;\l;AlienWorm\u object\worm; \n;Worm \c;\l;AlienWorm\u object\worm; \n;Ver
\t;Miscellaneous : \t;Catégories spéciales:
\button 136; \c;\l;Me\u object\human; \n;You! \button 136; \c;\l;Me\u object\human; \n;Vous!
\c;\l;Mine\u object\mine; \n;Mine \c;\l;Mine\u object\mine; \n;Mine fixe
\c;\l;Barrier\u object\barrier; \n;Barrier \c;\l;Barrier\u object\barrier; \n;Barrière fixe
\c;\l;Wreck\u object\wreck; \n;Derelict bot \c;\l;Wreck\u object\wreck; \n;Epave de robot
\c;\l;Ruin\u object\ruin; \n;Derelict building \c;Ruin \n;Bâtiment en ruine
\t;Flags and Other Indicators : \t;Catégories des marqueurs:
\c;\l;BlueFlag\u object\flag; \n;Blue Flag \c;\l;WayPoint\u object\waypoint; \n;Indicateur de chemin
\c;\l;RedFlag\u object\flag; \n;Red Flag \c;\l;BlueFlag\u object\flag; \n;Drapeau bleu
\c;\l;GreenFlag\u object\flag; \n;Green Flag \c;\l;RedFlag\u object\flag; \n;Drapeau rouge
\c;\l;YellowFlag\u object\flag; \n;Yellow Flag \c;\l;GreenFlag\u object\flag; \n;Drapeau vert
\c;\l;VioletFlag\u object\flag; \n;Violet Flag \c;\l;YellowFlag\u object\flag; \n;Drapeau jaune
\c;\l;WayPoint\u object\waypoint; \n;Checkpoint \c;\l;VioletFlag\u object\flag; \n;Drapeau violet
\c;\l;EnergySite\u object\enerspot; \n;Underground Energy Deposit \c;\l;PowerSpot\u object\enerspot; \n;Energie en sous-sol
\c;\l;TitaniumSite\u object\stonspot; \n;Underground Titanium Deposit \c;\l;TitaniumSpot\u object\stonspot; \n;Minerai de titanium en sous-sol
\c;\l;UraniumSite\u object\uranspot; \n;Underground Uranium Deposit \c;\l;UraniumSpot\u object\uranspot; \n;Minerai d'uranium en sous-sol
\t;See also
\l;CBOT Language\u cbot; and \l;Variables\u cbot\type;. \t;Voir aussi
\l;Programmation\u cbot; et \l;types\u cbot\type;.

View File

@ -1,72 +1,73 @@
\b;Instruction \c;class\n; \b;Instruction \c;class\n; (pour spécialistes)
This allows you to declare a class definition using following syntax: La syntaxe pour déclarer une classe est la suivante:
\c; \c;
\s;public class ClassName \s;public class NomDeLaClasse
\s;{ \s;{
\s; declarations; \s; déclarations;
\s;} \s;}
\n; \n;
Classes can only be \l;public\u cbot\public;, that is they can be used from all bots in a mission. Class members are also public, that is they are accessible from outside the class. Class members can be fields or functions (also called methods), for example the followin class \c;MyClass\n; contains 4 fields (a, b, x and s) and one method (MyFunction). Une classe peut contenir des \l;variables\u cbot\var; et des \l;fonctions\u cbot\function;. Mais dans la terminologie des langages orientés objets, on les appelle "champs" et "méthodes":
\tab;\c; variable -> champ\n;
\tab;\c; fonction -> méthode\n;
Le terme "membre" désigne un champ ou une méthode.
La classe est d'office \l;publique\u cbot\public; (disponible partout). Les membres de la classe sont également publiques (disponible à tous). Les déclarations peuvent être des déclarations de champs ou des déclarations de méthodes (avec le \l;bloc\u cbot\bloc; d'exécution), par exemple:
\c; \c;
\s;public class MyClass \s;public class MaClasse
\s;{ \s;{
\s; int a, b; \s; int a, b;
\s; float x = 3.33; \s; float x = 3.33;
\s; string s = "hello"; \s; string s = "hello";
\s; float MyFunction( float value ) \s; float MaPrimitive( float value )
\s; { \s; {
\s; return (value*x)-1; \s; return (value*x)-1;
\s; } \s; }
\s;} \s;}
\n; \n;
As shown in this exemple the class members can be initialized (\c;x=3.33\n;). You can also define a constructor which is a special method having the same name as the class name. This method will be called automatically at creation time of a class instance. You can also declare more than one method with the same name but different parameters. Comme le montre cet exemple, il est possible d'initialiser la valeur des champs par défaut (\c;x=3.33\n;), ce qui rend le constructeur inutile. Toutefois, il est possible de définir un constructeur, en créant une méthode (de type \c;void\n;) ayant le même nom que la classe.
Il est également possible de définir plusieurs méthodes ayant le même nom, mais avec des paramètres différents (ce qui est aussi valable pour les \l;fonctions\u cbot\function;).
\c; \c;
\s;public class MyClass \s;public class MaClasse
\s;{ \s;{
\s; int a, b; \s; int a, b;
\s; void MyClass( ) \s; void MaClasse( )
\s; { \s; {
\s; a = 2; b = 3; \s; a = 2; b = 3;
\s; } \s; }
\s; void MyClass( int a, int b ) \s; void MaClasse( int a, int b )
\s; { \s; {
\s; this.a = a; this.b = b; \s; this.a = a; this.b = b;
\s; } \s; }
\s;} \s;}
\n; \n;
In this example two constructors are declared for \c;MyClass\n;, one without parameters and the other one with two parameters. As the names of the parameters of the second constructor are the same as the names of the two members \c;a\n; et \c;b\n; we must use the \c;\l;this\u cbot\this;.a\n; and \c;\l;this\u cbot\this;.b\n; to avoid confusion with the parameters. Another more simpler solution would be to give different names to the parameters. Cet exemple déclare deux constructeurs pour \c;MaClasse\n;, l'un sans paramètre, l'autre avec deux paramètres. Comme les paramètres ont été nommés avec le même nom que les éléments \c;a\n; et \c;b\n;, il est nécessaire d'utiliser \c;\l;this\u cbot\this;.a\n; et \c;\l;this\u cbot\this;.b\n; pour accéder aux éléments de l'instance (une solution plus simple consiste à donner des noms différents pour les paramètres).
Les constructeurs sont appelés automatiquement à la définition d'une instance de la classe.
\c; \c;
\s;void Test( ) \s;void Test( )
\s;{ \s;{
\s; MyClass item1(); // constr. w/o parameters \s; MaClasse item1(); // constr. sans paramètre
\s; MyClass item2(4, 5); // constr. with 2 parameters \s; MaClasse item2(4, 5); // constr. avec 2 paramètres
\s; MyClass item3; // no constructor called, \s; MaClasse item3; // pas de constructeur,
\s; // therefore item3 == null \s; // item3 == null
\s;} \s;}
\n; \n;
You can also define a destructor. This must be a \c;void\n; fonction without parameters that has the same name as the class name but prefixed by the ~ character. The destructor is called automatically as soon as the class instance is no more referenced by anyone. Un destructeur peut être également défini. C'est une méthode \c;void\n; sans paramètre ayant le nom de la classe précédé du caractère "tilde" ~. Le destructeur est appelé dès qu'il n'y a plus aucune \l;référence\u cbot\pointer; vers une instance donnée.
\c; \c;
\s;public class MyClass \s;public class MaClasse
\s;{ \s;{
\s; static private int counter = 0; // instance counter \s; static private int compteur = 0;
\s; void MyClass( ) \s; void MaClasse( ) { compteur ++ ); // compte
\s; { \s; void ~MaClasse( ) { compteur -- }; // décompte
\s; counter ++; // one instance more
\s; }
\s; void ~MyClass( )
\s; {
\s; counter --; // one instance less
\s; }
\s;} \s;}
\s;void Test() \s;void Test()
\s;{ \s;{
\s; MyClass item1( ); // counter = 1 \s; MaClasse item1( ); // compteur = 1
\s; MyClass item2( ); // counter = 2 \s; MaClasse item2( ); // compteur = 2
\s; item1 = null; // counter = 1 \s; item1 = null; // compteur = 1
\s;} // counter = 0 \s;} // compteur = 0
\n; \n;
If you pass a class instance as parameter to a \l;function\u cbot\function;, the function only receives a \l;reference\u cbot\pointer; to the instance. That means if you modify the instance in the function, the instance that has been passed to the function will be actuallay modified. Lorsqu'on donne l'instance d'une classe comme paramètre d'une \l;fonction\u cbot\function;, c'est toujours la \l;référence\u cbot\pointer; qui est passée.
\t;See also \t;Voir aussi
\c;\l;public\u cbot\public;\n;, \c;\l;private\u cbot\private;\n;, \c;\l;static\u cbot\static;\n;, \c;\l;synchronized\u cbot\synchro;\n;, \c;\l;new\u cbot\new;\n;, \c;\l;reference\u cbot\pointer;\n;, \c;\l;this\u cbot\this;\n; \c;\l;public\u cbot\public;\n;, \c;\l;private\u cbot\private;\n;, \c;\l;static\u cbot\static;\n;, \c;\l;synchronized\u cbot\synchro;\n;, \c;\l;new\u cbot\new;\n;, \c;\l;pointer\u cbot\pointer;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,8 +1,14 @@
\b;Instruction \c;close\n; \b;Instruction \c;close\n;
Close a file opened previously with \c;\l;open\u cbot\open;\n;. This is a method of the \c;\l;file\u cbot\file;\n; class; therefore you cannot write \c;close()\n; but only \c;handle.close()\n;¦: L'instruction \c;close();\n; ferme un fichier de texte dans le dossier files/. Cette instruction est une méthode de la classe \c;\l;file\u cbot\file;\n;. C'est la raison pour laquelle on n'écrit jamais \c;close()\n; tout seul, mais \c;handle.close()\n;:
\c; \c;
\s; handle.close(); \s; handle.close();
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;readln\u cbot\readln;\n;, \c;\l;writeln\u cbot\writeln;\n; and \c;\l;eof\u cbot\eof;\n;. \c;file \n; = fichier
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;handle\n; = poignée, manipuler
\c;open \n; = ouvre
\c;close \n; = ferme
\t;Voir aussi
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;readln\u cbot\readln;\n;, \c;\l;writeln\u cbot\writeln;\n; et \c;\l;eof\u cbot\eof;\n;.
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,29 +1,28 @@
\b;Conditions \b;Les conditions
A condition is a special \l;expression\u cbot\expr; that returns a \l;boolean\u cbot\bool; value, that can only be either \c;\l;true\u cbot\true;\n; or \c;\l;false\u cbot\false;\n;. With a condition, you can choose f. ex. if the instructions in a \c;\l;while\u cbot\while;\n; loop must be repeated again, or if the instruction in a \c;\l;if\u cbot\if;\n; bloc must be executed. Une condition est une \l;expression\u cbot\expr; particulière, qui prend une valeur \l;booléenne\u cbot\bool;, c'est-à-dire pouvant être vraie ou fausse (\c;\l;true\u cbot\true;\n; ou \c;\l;false\u cbot\false;\n;). Une condition détermine par exemple s'il faut continuer ou non une boucle \c;\l;while\u cbot\while;\n;.
Here are some operators that you can use in conditions to compare two values : Les opérateurs de comparaison sont:
\c;a == b \n;\c;a\n; equals \c;b\n; \c;a == b \n;\c;a\n; égal à \c;b\n;
\c;a != b \n;\c;a\n; is different from \c;b\n; \c;a!= b \n;\c;a\n; différent de \c;b\n;
\c;a < b \n;\c;a\n; smaller than \c;b\n; \c;a < b \n;\c;a\n; plus petit que \c;b\n;
\c;a <= b \n;\c;a\n; smaller than or equal to \c;b\n; \c;a <= b \n;\c;a\n; plus petit ou égal à \c;b\n;
\c;a > b \n;\c;a\n; greater than \c;b\n; \c;a > b \n;\c;a\n; plus grand que \c;b\n;
\c;a >= b \n;\c;a\n; greater than or equal to \c;b\n; \c;a >= b \n;\c;a\n; plus grand ou égal à \c;b\n;
For example : Par exemple:
\c;12 == 12 \n;returns true \c;12 == 12 \n;retourne vrai
\c;45 != 47 \n;returns true \c;45!= 47 \n;retourne vrai
\c;99 == 98 \n;returns false \c;99 == 98 \n;retourne faux
\c;12 < -1 \n;returns false \c;12 < -1 \n;retourne faux
\c;12 >= 10 \n;returns true \c;12 >= 10 \n;retourne vrai
\c;12 >= 12 \n;returns true \c;12 >= 12 \n;retourne vrai
\t;Remarque \t;Remarque
Be careful not to confuse the equality comparison \c;==\n; with the assignment of a \l;variable\u cbot\var; \c;=\n;. Il faut faire très attention à ne pas confondre la comparaison d'égalité \c;==\n; avec l'affectation d'une \l;variable\u cbot\var; \c;=\n;.
\c;a == b\n; is an expression that compares \c;a\n; with \c;b\n;. \c;a == b\n; est une expression qui compare \c;a\n; avec \c;b\n;.
\c;a = b\n; is an expression that copies the value of \c;b\n; into \c;a\n;. \c;a = b\n; est une expression qui copie la valeur de \c;b\n; dans \c;a\n;.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,13 +1,13 @@
\b;Instruction \c;continue\n; \b;Instruction \c;continue\n;
Syntax : Syntaxe:
\s;\c;while ( condition ) \s;\c;while ( condition )
\s;{ \s;{
\s; continue; \s; continue;
\s;} \s;}
\n; \n;
With this instruction, you can jump over the rest of instructions in the \c;\l;bloc\u cbot\bloc;\n; of a \c;\l;while\u cbot\while;\n; or \c;\l;for\u cbot\for;\n; loop: The execution will resume at the beginning of the bloc, the next time the loop is repeated. Cette instruction permet de passer prématurément au tour de boucle suivant. On peut l'utiliser dans un bloc après une instruction \c;\l;while\u cbot\while;\n; ou \c;\l;for\u cbot\for;\n;.
Here is an example: Voici un exemple d'utilisation:
\s;\c;int i = 0; \s;\c;int i = 0;
\s;while ( i < 5 ) \s;while ( i < 5 )
\s;{ \s;{
@ -19,7 +19,10 @@ Here is an example:
\s; \n;Instructions ...\c; \s; \n;Instructions ...\c;
\s;} \s;}
\n; \n;
The instructions will only be executed for the values of \c;i\n; 1, 2, 4 and 5. Les instructions seront exécutées pour les valeurs de \c;i\n; 1, 2, 4 et 5.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;continue\n; = continuer
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,10 +1,12 @@
\b;Instruction \c;deletefile\n; \b;Instruction \c;deletefile\n;
The deletefile instruction deletes an existing file in the files/ folder. L'instruction \c;deletefile();\n; supprime un fichier dans le dossier files/.
Files can only be deleted in the files/ folder which is located in the folder where Colobot has been installed. You cannot not delete files that are located elsewhere than in the files/ folder. Syntaxe:
Syntax¦:
\s;\c;deletefile ( filename );\n; \s;\c;deletefile ( filename );\n;
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;delete\n; = effacer
\c;file \n; = fichier
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,15 +1,20 @@
\b;Instruction \c;deleteinfo\n; \b;Instruction \c;deleteinfo\n;
Syntax¦: Syntaxe:
\s;\c;deleteinfo ( name, power );\n; \s;\c;deleteinfo ( name, power );\n;
Delete an existing information in the closest \l;information exchange post\u object\exchange;. Supprime une information de la \l;borne\u object\exchange; la plus proche.
\t;name: \c;string\n; \t;name: \c;string\n;
Name of the information to be deleted. This name is a string: it must be written in quotation marks "¦". Nom de l'information à supprimer dans la borne. Ce nom est une chaîne de caractères; il doit donc être donné entre guillemets "".
\t;power: \c;float\n; \t;power: \c;float\n;
Power of the transmitter, which corresponds to the maximal distance between the sender and the exchange post. If the distance is longer, the information won't be deleted. Default value is 10 metres. Puissance de l'émetteur, qui correspond à la distance maximale jusqu'où peut être la borne. La valeur par défaut est de 10 mètres.
\t;See also \t;Dictionnaire anglais-français
\c;\l;receive\u cbot\receive;\n;, \c;\l;send\u cbot\send;\n; and \c;\l;testinfo\u cbot\testinfo;\n;. \c;delete\n; = effacer
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;name \n; = nom
\c;power \n; = puissance
\t;Voir aussi
\c;\l;receive\u cbot\receive;\n;, \c;\l;send\u cbot\send;\n; et \c;\l;testinfo\u cbot\testinfo;\n;.
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,15 +1,17 @@
\b;Instruction \c;direction\n; \b;Instruction \c;direction\n;
Syntax : Syntaxe:
\s;\c;direction ( pos );\n; \s;\c;direction ( pos );\n;
Calculates the rotation that a robot must perform in order to point towards a given position. Calcule la direction que doit prendre le robot pour se diriger vers une position donnée.
\t;pos: \c;\l;point\u cbot\point;\n; \t;pos: \c;\l;point\u cbot\point;\n;
Position towards which the robot must point. Position à atteindre.
\t;Return value: \c;\l;float\u cbot\float;\n; \t;Valeur retournée: \c;\l;float\u cbot\float;\n;
Angle of the rotation that must be performed. -90 means f. ex. a rotation of 90 degrees to the right. Angle en degré de la rotation à effectuer. -90 signifie une rotation d'un quart de tour vers la droite, par exemple.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;direction\n; = direction
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,30 +1,30 @@
\b;Instruction \c;distance\n; \b;Instruction \c;distance\n;
With the instruction \c;distance( , )\n; you can calculate the distance between two positions. Avec l'instruction \c;distance( , )\n; vous pouvez calculer la distance entre deux positions. Si vous écrivez \c;position\n; tout seul, cela donne la position du robot qui exécute le programme. Si vous écrivez le nom d'une variable suivie de \c;.position\n;, cela donne la position de l'objet décrit par la variable.
\b;Basic use Voici comment avancer d'une distance égale à la distance entre le robot et la fourmi la plus proche:
If you write \c;position\n; alone, this gives you the position of the bot that executes the program. If you write the name of a variable followed by \c;.position\n;, this gives you the position of the object described in the variable.
Here is a program that moves forward, covering exactly the distance between the bot and the closest ant:
\c; \c;
\s; item = \l;radar\u cbot\radar;(AlienAnt); \s; chose = \l;radar\u cbot\radar;(AlienAnt);
\s; \l;move\u cbot\move;(distance(position, item.position)); \s; \l;move\u cbot\move;(distance(position, chose.position));
\n; \n;
This is of course pure suicide. Better to stop 40 meters before, in order to be at shooting range: Ceci est bien sûr parfaitement suicidaire, mieux vaut s'arrêter 40m avant, pour être à la bonne distance de tir:
\c; \c;
\s; item = radar(AlienAnt); \s; chose = radar(AlienAnt);
\s; move(distance(position, item.position) - 40); \s; move(distance(position, chose.position) - 40);
\n; \n;
\b;For specialists \b;Pour spécialistes
Syntax: Syntaxe:
\s;\c;distance ( pos1, pos2 );\n; \s;\c;distance ( pos1, pos2 );\n;
Calculates the distance between two positions. Calcule la distance entre deux points.
\t;pos1, pos2: \c;\l;point\u cbot\point;\n; \t;pos1, pos2: \c;\l;point\u cbot\point;\n;
Coordinates of the two positions. Coordonnées des deux points.
\t;Return value: \c;\l;float\u cbot\float;\n; \t;Valeur retournée: \c;\l;float\u cbot\float;\n;
Distance between the two positions. Distance entre les deux points.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;distance\n; = distance
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,14 +1,17 @@
\b;Instruction \c;distance2d\n; \b;Instruction \c;distance2d\n;
Syntax: Syntaxe:
\s;\c;distance2d ( pos1, pos2 );\n; \s;\c;distance2d ( pos1, pos2 );\n;
Calculates the distance between two positions (ignores the z coordinate). Calcule la distance "à plat" entre deux points, c'est-à-dire sans tenir compte de l'élévation (coordonnée z).
\t;pos1, pos2: \c;\l;point\u cbot\point;\n; \t;pos1, pos2: \c;\l;point\u cbot\point;\n;
Coordinates of the two positions. Coordonnées des deux points.
\t;Return value: \c;\l;float\u cbot\float;\n; \t;Valeur retournée: \c;\l;float\u cbot\float;\n;
Distance between the two positions. Distance entre les deux points.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;distance\n; = distance
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,18 +1,18 @@
\b;Instruction \c;do - while\n; \b;Instruction \c;do - while\n;
Syntax: Syntaxe:
\s;\c;do \s;\c;do
\s;{ \s;{
\s; \n;Instructions ...\c; \s; \n;Instructions ...\c;
\s;} \s;}
\s;while ( condition ); \s;while ( condition );
\n; \n;
This instruction allows you to perform several times the instructions inside the \l;block\u cbot\bloc;. The instructions are executed at least once, because the condition is tested only afterwards. Cette structure de boucle permet d'exécuter plusieurs fois les instructions comprises dans le \l;bloc\u cbot\bloc;. Ces instructions sont toujours exécutées au moins une fois, puisque la condition n'est examinée qu'après exécution de ces instructions.
Be careful not to confuse the instruction \c;do { } while ( );\n; with the instruction \c;\l;while\u cbot\while; ( ) { }\n;; the latter tests the condition before the instructions in the block are executed. Attention à ne pas confondre \c;do { } while( );\n; avec \c;\l;while\u cbot\while;( ) { }\n;, qui effectue le test avant le premier tour de boucle.
\t;\c;condition\n; \t;\c;condition\n;
The instructions in the block are performed over and over again, as long as the \l;condition\u cbot\cond; is true. Tant que cette \l;condition\u cbot\cond; est vraie, les instructions dans le bloc sont répétées.
Here is an example : Voici un exemple d'utilisation:
\s;\c;do \s;\c;do
\s;{ \s;{
\s; p = radar(TitaniumOre); \s; p = radar(TitaniumOre);
@ -20,9 +20,13 @@ Here is an example :
\s;while ( p == null ); \s;while ( p == null );
\n; \n;
\t;Attention \t;Attention
Always put a \l;semicolon\u cbot\term; at the end of the line \c;while ( )\n;. Il faut toujours mettre un \l;point-virgule\u cbot\term; à la fin de la ligne \c;while ( )\n;.
The instructions \c;\l;break\u cbot\break;\n; and \c;\l;continue\u cbot\continue;\n; can be useful inside a block following the instruction \c;do { }\n;. Les instructions \c;\l;break\u cbot\break;\n; et \c;\l;continue\u cbot\continue;\n; sont utiles à l'intérieur d'un bloc \c;while { }\n;.
\t;See also \t;Dictionnaire anglais-français
\l;Instructions\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;do \n; = faire
\c;while\n; = tant que
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,29 +1,32 @@
\b;Instruction \c;drop\n; \b;Instruction \c;drop\n;
The instruction \c;drop();\n; instructs the bot to drop whatever the operating arm is carrying on the ground, on the platform of a building or on the power cell location of a bot. L'instruction \c;drop()\n; permet de poser au sol, sur l'emplacement arrière d'un robot ou sur le socle d'un bâtiment, l'objet que le robot tient dans la pince de son bras manipulateur.
\b;Basic use \b;Utilisation courante
The instruction \c;drop();\n; written in this form drops the object in front of the bot. Here is a short program that grabs an object in front of the bot and drops it 5 meters further: L'instruction \c;drop();\n; écrite sous cette forme pose devant le robot l'objet que le robot tient. Voici par exemple comment saisir ce qui se trouve devant le robot pour le poser 5m plus loin:
\c; \c;
\s; \l;grab\u cbot\grab;(); \s; \l;grab\u cbot\grab;();
\s; \l;move\u cbot\move;(5); \s; \l;move\u cbot\move;(5);
\s; drop(); \s; drop();
\n; \n;
\b;For specialists \b;Pour spécialistes
Syntax: Syntaxe:
\s;\c;drop ( oper );\n; \s;\c;drop ( oper );\n;
This instruction appeals to the operating arm of a \l;grabber bot\u object\botgr;, in order to drop what it is holding. Actionne le bras manipulateur du \l;robot déménageur\u object\botgr;, pour déposer l'objet saisi.
\t;oper: \c;\l;int\u cbot\int;\n; (default value\c;InFront\n;) \t;oper: \c;\l;int\u cbot\int;\n; (\c;InFront\n; par défaut)
Oper indicates where the robot should drop the object. If no indication is given, the object is dropped in front of the bot. Position à atteindre avec la bras manipulateur. Si cette indication n'est pas fournie, on suppose qu'il s'agit du cas le plus fréquent où l'objet est pris ou déposé devant le robot.
\c;InFront \n; Drops in front (default value). \c;InFront \n; Dépose devant (par défaut).
\c;Behind \n; Drops behind. \c;Behind \n; Dépose derrière.
\c;EnergyCell\n; Drops on the bot's own power cell location. \c;EnergyCell\n; Dépose sa propre pile.
\t;Return value: \c;\l;int\u cbot\int;\n; \t;Valeur retournée: \c;\l;int\u cbot\int;\n;
Normally an error stops the program. You can prevent the program from stopping on errors by using the \c;\l;errmode\u cbot\errmode;(0)\n; instruction. A value different from zero if an error occurred is then returned by \c;drop();\n;. Normalement, une erreur stoppe l'exécution du programme. Si l'instruction \c;drop\n; est précédée de \c;\l;errmode\u cbot\errmode;(0);\n;, une valeur nulle est retournée si tout est ok, ou valeur non nulle si une erreur est intervenue.
\c;== 0 \n;object was dropped \c;== 0 \n;objet déposé
\c;!= 0 \n;error, no object was dropped \c;!= 0 \n;erreur, pas d'objet déposé
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;drop\n; = laisser tomber
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,15 +1,21 @@
\b;Instruction \c;eof\n; \b;Instruction \c;eof\n;
Test the end of file condition of an open file. This is a method of the \c;\l;file\u cbot\file;\n; class; therefore you cannot write \c;eof()\n; but only \c;handle.eof()\n;¦: L'instruction \c;eof();\n; teste s'il existe encore une ou plusieurs lignes à lire dans le fichier de texte ouvert dans le dossier files/. Cette instruction est une méthode de la classe \c;\l;file\u cbot\file;\n;. C'est la raison pour laquelle on n'écrit jamais \c;eof()\n; tout seul, mais \c;handle.eof()\n;:
\c; \c;
\s; if ( handle.eof() ) \s; if ( handle.eof() )
\n; \n;
Example¦: Exemple:
\c; \c;
\s; while ( not handle.eof() ) \s; while ( not handle.eof() )
\s; { \s; {
\s; s = handle.readln(); \s; s = handle.readln();
\s; } \s; }
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;readln\u cbot\readln;\n; and \c;\l;writeln\u cbot\writeln;\n;. \c;file \n; = fichier
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;handle\n; = poignée, manipuler
\c;readln\n; = abréviation de "read line", lit une ligne
\c;eof \n; = abréviation de "end of file", fin de fichier
\t;Voir aussi
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;readln\u cbot\readln;\n; et \c;\l;writeln\u cbot\writeln;\n;.
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,33 +1,32 @@
\b;Instruction \c;errmode\n; \b;Instruction \c;errmode\n;
The \c;errmode();\n; instruction allows you to chose if the program should stop when an error occurs in one of the following instructions: \c;\l;goto\u cbot\goto;\n;, \c;\l;move\u cbot\move;\n;, \c;\l;grab\u cbot\grab;\n;, \c;\l;drop\u cbot\drop;\n;, etc. L'instruction \c;errmode();\n; détermine la réaction du programme lorsqu'une erreur est rencontrée dans une instruction du type \c;\l;goto\u cbot\goto;\n;, \c;\l;move\u cbot\move;\n;, \c;\l;grab\u cbot\grab;\n;, \c;\l;drop\u cbot\drop;\n;, etc.
\b;For specialists \b;Pour spécialistes
Syntax¦: Syntaxe:
\s;\c;errmode ( mode );\n; \s;\c;errmode ( mode );\n;
Normally the program is stopped when an error occurs. If you use the instruction \c;errmode(0);\n; at the beginning of the program, the instructions listed above return a value different from zero if the instruction could not be performed. Normalement, un programme s'arrête dès qu'une erreur est rencontrée. En ajoutant \c;errmode(0);\n; au début du programme, une instruction \c;goto\n; qui n'arrive pas à destination retourne une valeur non nulle.
\t;mode: \c;\l;float\u cbot\float;\n; (\c;1\n; per default) \t;mode: \c;\l;float\u cbot\float;\n; (\c;1\n; par défaut)
Error treatment mode. Mode de gestion des erreurs.
\c;0\n; -> continues program execution and returns a non zero value \c;0\n; -> continue en retournant une valeur non nulle
\c;1\n; -> stops the program (default behavior) \c;1\n; -> stoppe le programme
Exemple 1¦: Exemple 1:
\s;\c;errmode(0); \s;\c;errmode(0);
\s;while ( goto(pos) != 0 ) \s;while ( goto(pos) != 0 )
\s;{ \s;{
\s; wait(2); \s; wait(2);
\s;} \s;}
\n; \n;
Exemple 2¦: Exemple 2:
\s;\c;errmode(0); \s;\c;errmode(0);
\s;int err; \s;int err;
\s;err = goto(pos); \s;err = goto(pos);
\s;if ( err != 0 ) \s;if ( err != 0 )
\s;{ \s;{
\s; \n;goto did not perform correctly ...\c; \s; \n;gestion de l'erreur ...\c;
\s; \n;take some appropriate action ...\c;
\s;} \s;}
\n; \n;
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,88 +1,55 @@
\b;Expressions \b;Les expressions
Expressions can include the following operators: Les expressions peuvent contenir les opérations suivantes:
\c;+\n; addition \c;+ \n; addition
\c;-\n; subtraction \c;- \n; soustraction
\c;*\n; multiplication \c;* \n; multiplication
\c;/\n; division \c;/ \n; division
\c;%\n; remainder of the division (only for the type \c;\l;int\u cbot\int;\n;) \c;% \n; reste de la division (seulement pour le type \c;\l;int\u cbot\int;\n;)
\c;**\n; élévation à la puissance
With the addition operator \c;+\n;, you can not only add numbers, you can also append \l;strings\u cbot\string;. L'addition permet non seulement d'additionner des nombres, mais également d'appondre des \l;chaînes de caractères\u cbot\string;.
L'opérateur \c;%\n; est parfois appelé "modulo".
\c; \c;
\s; int i = 12+3; // returns 15 \s; int i = 12+3; // donne 15
\s; string s = "a"+"bc"; // returns "abc" \s; string s = "a"+"bc"; // donne "abc"
\s; int i = 2-5; // returns -3 \s; int i = 2-5; // donne -3
\s; float f = 3.01*10; // returns 30.1 \s; float f = 3.01*10; // donne 30.1
\s; int i = 5/3; // returns 1 \s; int i = 5/3; // donne 1
\s; float f = 5/3; // returns 1.67 \s; float f = 5/3; // donne 1.67
\s; float f = 5/0; // returns an error \s; float f = 5/0; // donne une erreur
\s; int i = 13%5; // returns 3 \s; int i = 13%5; // donne 3
\s; int i = -8%3; // returns -2 \s; int i = -8%3; // donne -2
\s; float f = 6**2; // donne 36
\n; \n;
An expression can include constants or \l;variables\u cbot\var;. For example: Une expression peut contenir des constantes ou des \l;variables\u cbot\var;. Par exemple:
\s;\c; 12+dist\n; \s;\c; 12+distance\n;
Multiplications and divisions are performed before additions and subtractions. In order to be sure that the operations are performed in the right order, use brackets: Les multiplications et les divisions sont effectuées avant les additions et les soustractions. En cas de doute, mieux vaut utiliser des parenthèses.
\c; \c;
\s; 12*a+b/c \n;is equivalent to\c; (12*a)+(b/c) \s; 12*a+b/c \n;est équivalent à\c; (12*a)+(b/c)
\s; 2.5*(dist+range) \s; 2.5*(distance+marge)
\n; \n;
In order to improve readability, you can put as many spaces as you want: Vous pouvez mettre autant d'espaces que vous le désirez, pour améliorer la lisibilité:
\c; \c;
\s; 12*a + b/c \s; 12*a + b/c
\s; 2.5 * (dist+range) \s; 2.5 * (distance+marge)
\n; \n;
Here is a list of mathematical functions: Les fonctions mathématiques suivantes sont disponibles:
\c;sin(angle) \n;sinus \c;sin(angle) \n;sinus
\c;cos(angle) \n;cosinus \c;cos(angle) \n;cosinus
\c;tan(angle) \n;tangent \c;tan(angle) \n;tangente
\c;asin(value) \n;arc-sinus \c;asin(valeur) \n;arc-sinus
\c;acos(value) \n;arc-cosinus \c;acos(valeur) \n;arc-cosinus
\c;atan(value) \n;arc-tangente \c;atan(valeur) \n;arc-tangente
\c;sqrt(value) \n;square root \c;sqrt(valeur) \n;racine carrée
\c;pow(x, y) \n;x power y \c;pow(x, y) \n;x puissance y
\c;rand() \n;random value ranging between 0 and 1 \c;rand() \n;valeur aléatoire comprise entre 0 et 1
\c;abs(valeur) \n;valeur absolue
Angles are in degrees. Les angles sont exprimés en degrés.
\t;Compound assignment operators (for specialists) \t;Voir aussi
Besides the \c;=\n; operators for variable assignment there are several compound-assignment operators. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.
The compound-assignment operators combine the \c;=\n; assignment operator with another binary operator such as \c;+\n; or \c;-\n;. Compound-assignment operators perform the operation specified by the additional operator and then assign the result to the left operand. For example, a compound-assignment expression such as
\c;\s;expression1 += expression2
is equivalent to
\c;\s;expression1 = expression1 + expression2
\c;+=\n; addition
\c;-=\n; subtraction
\c;*=\n; multiplication
\c;/=\n; division
\c;%=\n; remainder of the division (only for the type \c;\l;int\u cbot\int;\n;)
\t;Prefix and posfix increment- and decrement operators (for specialists)
The operators \c;++\n; and \c;--\n; allow you to increment (++) or to decrement (--) a variable in very compact and efficient manner.
For example to increment the variable \c;a\n; you can write
\c;\s; a++ ;
\n;instead of
\c;\s; a = a + 1 ;
\n;
The value of the expression \c;a++\n; is the value of the variable \c;a\n; before the increment. If you use the prefix operator \c;++a\n; the value of the expression is the value of the variable \c;a\n; after the increment. The same holds for the \c;--\n; decrement operator.
Exemples:
\c;\s; a = 2 ;
\s; b = a++ ;
\s; // now b contains 2 and a contains 3
\c;\s; a = 2 ;
\s; b = ++a ;
\s; // now b contains 3 and a contains 3
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

View File

@ -1,7 +1,7 @@
\b;Instruction \c;extern\n; \b;Instruction \c;extern\n;
The \c;extern\n; instruction determines the \l;function\u cbot\function; that acts as main program of a robot. The name of the function declared with \c;extern\n; will apear in the program list in the lower left corner of the screen. L'instruction \c;extern\n; détermine quelle est la \l;fonction\u cbot\function; qui fait office de programme principal. La fonction déclarée \c;extern\n; aura son nom dans la liste des programmes, en bas à gauche de la fenêtre.
\c; \c;
\s;extern void object::MowDown( ) \s;extern void object::Boum( )
\s;{ \s;{
\s; while ( true ) \s; while ( true )
\s; { \s; {
@ -10,7 +10,7 @@ The \c;extern\n; instruction determines the \l;function\u cbot\function; that a
\s; } \s; }
\s;} \s;}
\n; \n;
If the program contains other functions, only the main function must be preceded by \c;extern\n;. Si le programme utilise d'autres fonctions, seule la fonction principale doit être précédée de \c;extern\n;.
\c; \c;
\s;extern void object::Square( ) \s;extern void object::Square( )
\s;{ \s;{
@ -26,5 +26,5 @@ If the program contains other functions, only the main function must be preceded
\s; turn(90); \s; turn(90);
\s;} \s;}
\n; \n;
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,6 +1,8 @@
\b;Type \c;false\n; \b;Type \c;false\n;
This value means that a condition is not true; it is one of the two values that a \l;boolean\u cbot\bool; \l;variable\u cbot\var; can take. Cette valeur signifie "faux" pour une \l;variable\u cbot\var; \l;booléenne\u cbot\bool;.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;false\n; = faux
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,18 +1,20 @@
\b;Type \c;file\n; \b;Type \c;file\n;
This type is used for accessing files in the files/ folder. Ce type permet d'accéder à un fichier de texte dans le dossier files/.
\c; \c;
\s; file handle(); \s; file handle();
\n; \n;
Use the syntax above for declaring a file handle. You must use () to create an instance of the \c;file\n; class. Without the () the handle would have the value \c;\l;null\u cbot\null;\n;. Notez la présence des parenthèses, indispensables pour créer une instance de la classe \c;file\n;. Sans les parenthèses, \c;handle\n; aurait la valeur \c;null\n;.
Files can only be created and opened in the files/ folder which is located in the folder where Colobot has been installed. You cannot not create or open files elsewhere than in the files/ folder. \b;Pour spécialistes
En réalité, \c;file\n; n'est pas un type, mais une classe. \c;open\n;, \c;close\n;, \c;writeln\n; etc. sont des méthodes de la classe \c;file\n;. C'est la raison pour laquelle on écrit \c;classe.méthode()\n;:
\b;For specialists
\c;file\n; is actually not a simple type but a class. \c;open\n;, \c;close\n;, \c;writeln\n; etc. are methods of the \c;file\n; class. This is the reason why we always write \c;handle.method()\n;¦:
\c; \c;
\s; handle.open("test.txt", "w"); \s; handle.open("essai.txt", "w");
\s; handle.close(); \s; handle.close();
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;readln\u cbot\readln;\n;, \c;\l;writeln\u cbot\writeln;\n; and \c;\l;eof\u cbot\eof;\n;. \c;file \n; = fichier
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;handle\n; = poignée, manipuler
\t;Voir aussi
\c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;readln\u cbot\readln;\n;, \c;\l;writeln\u cbot\writeln;\n; et \c;\l;eof\u cbot\eof;\n;.
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,31 +1,32 @@
\b;Instruction \c;fire\n; \b;Instruction \c;fire\n;
The instruction \c;fire();\n; fires the bot's onboard cannon. L'instruction \c;fire();\n; permet de faire feu avec le canon du robot.
\b;Basic use \b;Utilisation courante
Generally this instruction is used to shoot one-second bursts: En général, on tire des rafales d'une seconde:
\c; \c;
\s; fire(1); \s; fire(1);
\n; \n;
\b;For specialists \b;Pour spécialistes
Syntax: Syntaxe:
\s;\c;fire ( time );\n; \s;\c;fire ( time );\n;
Fires the gun, with a burst that lasts a certain time. The longer the burst, the more energy it needs. This instruction can be used with the following bot types: Tire avec le canon, pendant un certain temps. Plus le tir est long, et plus l'énergie consommée est grande. Cette instruction peut être utilisée avec les robots suivants:
o \l;Shooter\u object\botfr; o \l;Robot shooter\u object\botfr;
o \l;Orga shooter\u object\botor; o \l;Robot orgaShooter\u object\botor;
o \l;Phazer shooter\u object\botphaz; o \l;Robot phazer\u object\botphaz;
When controlling the robot through programming, the only way to turn the gun left or right is to turn the whole robot with the instruction \c;\l;turn\u cbot\turn;\n;. Pour diriger le canon vers la gauche ou vers la droite, le seul moyen est d'orienter le robot avec l'instuction \c;\l;turn\u cbot\turn;\n;. Pour diriger le canon vers le haut ou vers le bas, il faut utiliser l'instruction \c;\l;aim\u cbot\aim;\n;.
In order to move the gun upward or downward, use the instruction \c;\l;aim\u cbot\aim;\n;.
\t;time: \c;\l;float\u cbot\float;\n; \t;time: \c;\l;float\u cbot\float;\n;
Duration of the burst. Generally, the value given is 1. Shorter bursts can also be performed in order to spare time and energy. Durée du tir, en secondes. Il s'agit généralement de valeurs relativement courtes. \c;fire(1);\n; tire une rafale identique à celle tirée lors la prise de commande du robot. Dans le cas où on survole une concentration importante de fourmis, on peut tirer des rafales plus longues, par exemple \c;fire(4);\n;. Pour économiser l'énergie, on peut tirer des rafales très courtes avec par exemple \c;fire(0.1);\n;.
\t;Return value: \c;\l;int\u cbot\int;\n; \t;Valeur retournée: \c;\l;int\u cbot\int;\n;
Zero if OK, or a value different from zero if an error occurred. Zéro si tout est ok, ou valeur non nulle si une erreur est intervenue.
\c;== 0 \n;the cannon has been fired \c;== 0 \n;tir effectué
\c;!= 0 \n;error, the cannon could not be fired \c;!= 0 \n;tir impossible
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;fire\n; = feu
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,17 +1,21 @@
\b;Instruction \c;flatground\n; \b;Instruction \c;flatground\n;
Syntax¦: Syntaxe:
\s;\c;flatground ( center, rmax );\n; \s;\c;flatground ( center, rmax );\n;
Calculates the maximal radius of a flat zone on which a building ca be built. Calcule le rayon maximal de la zone plate, permettant par exemple de construire un bâtiment.
\t;center: \c;\l;point\u cbot\point;\n; \t;center: \c;\l;point\u cbot\point;\n;
Center of the circlular zone. Position centrale de la zone circulaire.
\t;rmax: \c;\l;float\u cbot\float;\n; \t;rmax: \c;\l;float\u cbot\float;\n;
Maximal radius. Rayon maximal après lequel le calcul est stoppé.
\t;Return value: \c;\l;float\u cbot\float;\n; \t;Valeur retournée: \c;\l;float\u cbot\float;\n;
Radius of the flat zone (always between 0 and rmax). Rayon maximal de la zone plate, compris entre zéro et rmax.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;flat \n; = plat
\c;ground\n; = sol
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,25 +1,27 @@
\b;Type \c;float\n; \b;Type \c;float\n;
Use this type for most variables that contains numbers. Variables of this type can contain positive and negative numbers, whole or real numbers, for example: Ce type permet de représenter, de manière approchée, des nombres réels positifs ou négatifs. Par exemple:
\c; \c;
\s; 12.9 \s; 12.9
\s; 1.125 \s; 1.125
\s; 0.002 \s; 0.002
\s; -4.1 \s; -4.1
\n; \n;
If you need only whole numbers (f. ex. 12 or -5000), you should rather use the type \c;\l;int\u cbot\int;\n;. Pour représenter un nombre entier (12 ou -5000 par exemple) il faut utiliser le type \c;\l;int\u cbot\int;\n;.
\t;Attention \t;Remarque
Do not insert space or colon characters into a number. To separate the whole part from the fractional part, use a dot. Vous ne pouvez pas utiliser d'espace ou d'apostrophe dans un nombre.
\c; En informatique, la virgule est désignée par un point.
\s; Write and not
\s; 12.56 12 . 56
\s; -54.34 -54,34
\s;12895.69 12,895.69
\n;
\t;For specialists
Floating point numbers are represented in Colobot with 32 bits.
The highest value that can be represented is 3.4E+38.
The smallest value that can be represented is 3.4E-38.
\t;See also \c;4. \n;représente un nombre réel.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;4 \n;représente un nombre entier.
\t;Le coin du spécialiste
Sachez que ce type utilise 32 bits.
La valeur maximale représentable est 3.4E+38.
La valeur minimale représentable est 3.4E-38.
\t;Dictionnaire anglais-français
\c;float\n; = flotter
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,40 +1,36 @@
\b;Instruction \c;for\n; \b;Instruction \c;for\n;
Syntax: Syntaxe:
\s;\c;for ( before ; condition ; end ) \s;\c;for ( avant ; condition ; fin )
\s;{ \s;{
\s; \n;Instructions ...\c; \s; \n;Instructions ...\c;
\s;} \s;}
\n; \n;
This instruction allows you to execute a certain number of times the instructions contained in the \l;block\u cbot\bloc;. Cette structure de boucle permet d'exécuter plusieurs fois les instructions comprises dans le \l;bloc\u cbot\bloc;.
\t;\c;before\n; \t;\c;avant\n;
This instruction is executed before the first loop instance. Cette instruction simple est exécutée avant le premier tour de boucle.
\t;\c;condition\n; \t;\c;condition\n;
This \l;condition\u cbot\cond; determines if another instance of the loop must be executed. It is tested before every instance of the loop. Cette \l;condition\u cbot\cond; détermine s'il faut continuer la boucle. Elle est examinée avant chaque tour de boucle, y compris le dernier.
\t;\c;end\n; \t;\c;fin\n;
This instruction is executed at the end of every instance of the loop. Cette instruction simple est exécutée à la fin de chaque tour de boucle.
Example: count from 1 to 4 L'instruction \c;for\n; est rigoureusement équivalente à l'exemple suivant, utilisant \c;\l;while\u cbot\while;\n;:
\c;\s;\c;for ( i = 0 ; i <= 4 ; i++ ) \s;\c;avant;
\s;{
\s; message(i) ;
\s;}
\n;
The following example is strictly equivalent to a \c;for\n;-loop, but it uses the instruction \c;\l;while\u cbot\while;\n;:
\s;\c;before;
\s;while ( condition ) \s;while ( condition )
\s;{ \s;{
\s; \n;Instructions ...\c; \s; \n;Instructions ...\c;
\s; end; \s; fin;
\s;} \s;}
\n; \n;
\t;Attention \t;Attention
Do not put a \l;semicolon\u cbot\term; at the end of the line \c;for ( )\n;. Il ne faut pas mettre un \l;point-virgule\u cbot\term; à la fin de la ligne \c;for ( )\n;.
The instructions \c;\l;break\u cbot\break;\n; and \c;\l;continue\u cbot\continue;\n; can be useful inside a block following the instruction \c;for \n;. Les instructions \c;\l;break\u cbot\break;\n; et \c;\l;continue\u cbot\continue;\n; sont utiles à l'intérieur d'un bloc \c;for { }\n;.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;for\n; = pour
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,6 +1,5 @@
\b;Functions \b;Les fonctions
With functions you can divide your program into several parts, each of them will execute a specific task. Lorsqu'un programme devient long, il est conseillé de le fragmenter en plusieurs fonctions, qui accompliront chacune une tâche bien précise. Imaginons le programe suivant:
Let's imagine following program¦:
\c; \c;
\s;extern void object::Remote( ) \s;extern void object::Remote( )
\s;{ \s;{
@ -14,13 +13,8 @@ Let's imagine following program¦:
\s; wait(5); \s; wait(5);
\s;} \s;}
\n; \n;
\c;send\n; and \c;wait\n; are repeated several times. So it would be a good thing if we created a function that executes these two instructions: On constate que les deux instructions \c;send\n; et \c;wait\n; sont répétées plusieurs fois. Il est donc judicieux de créer une fonction \c;SendToPost\n; qui effectue ces deux instructions:
\c; \c;
\s;void object::SendToPost( float op )
\s;{
\s; send("order", op, 100);
\s; wait(5);
\s;}
\s;extern void object::Remote( ) \s;extern void object::Remote( )
\s;{ \s;{
\s; SendToPost(1); \s; SendToPost(1);
@ -28,58 +22,59 @@ Let's imagine following program¦:
\s; SendToPost(2); \s; SendToPost(2);
\s; SendToPost(4); \s; SendToPost(4);
\s;} \s;}
\s;void object::SendToPost( float op )
\s;{
\s; send("order", op, 100);
\s; wait(5);
\s;}
\n; \n;
A function can have paramteters¦: Une fonction peut recevoir des données en entrée. Il faut en donner la liste, avec à chaque fois le type de la variable et le nom qui lui est donné:
\c; \c;
\s;void Example( int a, float x, string s ) \s;void Exemple( int a, float x, string s )
\n; \n;
The \c;Exemple\n; function will reveive un integer \c;a\n;, a floating point number \c;x\n; and a string \c;s\n;. Parameters are "passed by value", that is the values of parameter variables in a function are copies of the values the caller specified as variables. If you pass an \c;int\n; to a function, its parameter is a copy of whatever value was being passed as argument, and the function can change its parameter value without affecting values in the code that invoked the function. La fonction \c;Exemple\n; va recevoir un nombre entier \c;a\n;, un nombre réel \c;x\n; et une chaîne \c;s\n;.
Les \l;tableaux\u cbot\array; et les instances de \l;classes\u cbot\class; sont toujours passées par \l;référence\u cbot\pointer;.
If you pass a \l;class\u cbot\class; instance or an \l;array\u cbot\array; as parameter to a function, the function only receives a \l;reference\u cbot\pointer; to the instance or the array. That means if you modify the instance or the array in the function, the instance or the array that has been specified by the caller will be actuallay modified. Une fonction peut effectuer un calcul et retourner le résultat avec l'instruction \c;\l;return\u cbot\return;\n;:
A function can also return a result with the \c;\l;return\u cbot\return;\n; instruction. Therefore the function must be declared no longer as void but as a type:
\c; \c;
\s;float Mean( float a, float b ) \s;float Moyenne( float a, float b )
\s;{ \s;{
\s; return (a+b)/2; \s; return (a+b)/2;
\s;} \s;}
\s; \s;extern void object::Essai( )
\s;extern void object::Test( )
\s;{ \s;{
\s; float value; \s; float value;
\s; value = Mean(2, 6); \s; value = Moyenne(2, 6);
\s; message( value ); // will display 4 \s; message( value ); // affiche 4
\s;} \s;}
\n; \n;
Some other examples¦: Voici d'autres exemples de fonctions:
\c; \c;
\s;float Pi( ) \s;float Pi( )
\s;{ \s;{
\s; return 3.1415; \s; return 3.1415;
\s;} \s;}
\s; \s;
\s;string Sign( float a ) \s;string Signe( float a )
\s;{ \s;{
\s; if ( a > 0 ) return "positive"; \s; if ( a > 0 ) return "positif";
\s; if ( a < 0 ) return "négative"; \s; if ( a < 0 ) return "négatif";
\s; return "null"; \s; return "nul";
\s;} \s;}
\n; \n;
You can declare several functions with the same name but different parameters¦: Il est autorisé de créer plusieurs fonctions ayant le même nom mais des paramètres différents:
\c; \c;
\s;float Pythagoras( float a, float b ) \s;float Pythagore( float a, float b )
\s;{ \s;{
\s; return sqrt((a*a)+(b*b)); \s; return sqrt((a*a)+(b*b));
\s;} \s;}
\s; \s;
\s;float Pythagoras( float a, float b, float c ) \s;float Pythagore( float a, float b, float c )
\s;{ \s;{
\s; return sqrt((a*a)+(b*b)+(c*c)); \s; return sqrt((a*a)+(b*b)+(c*c));
\s;} \s;}
\n; \n;
CBOT will call either the one or the other function depending on the paramteres passed. Lors de l'appel à la fonction, CBOT recherche la fonction dont les paramètres correspondent au mieux.
You can also declare a function \l;public\u cbot\public; so it can be used by other bots. \t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

View File

@ -1,35 +1,33 @@
\b;Instruction \c;goto\n; \b;Instruction \c;goto\n;
The instruction \c;goto();\n; instructs the bot to reach a given position. L'instruction \c;goto();\n; permet de déplacer le robot vers une certaine position.
\b;Basic use \b;Utilisation courante
The most current use consists in moving the bot to an object located with the instruction \c;\l;radar\u cbot\radar;();\n;. If the information returned by the \c;\l;radar\u cbot\radar;();\n; has been stored in a certain variable, write the name of the variable followed by \c;.position\n; in order to get the position of the object. Here is an example of a program that looks for a \l;titanium cube\u object\titan;, goes to the position and grabs it: En général on déplace le robot vers un objet qu'on a détecté avec l'instruction \c;\l;radar\u cbot\radar;();\n;. Si on a mis les informations rendues par \c;\l;radar\u cbot\radar;();\n; dans une certaine variable, il faut écrire le nom de la variable suivi de \c;.position\n; pour obtenir la position de l'objet. Voici par exemple comment chercher un cube de titanium, aller vers la position du cube et le saisir:
\c; \c;
\s; item = \l;radar\u cbot\radar;(Titanium); \s; object chose;
\s; goto(item.position); \s; chose = \l;radar\u cbot\radar;(Titanium);
\s; goto(chose.position);
\s; \l;grab\u cbot\grab;(); \s; \l;grab\u cbot\grab;();
\n; \n;
\b;For specialists \b;Pour spécialistes
Syntax: Syntaxe:
\s;\c;goto ( position, altitude, goal, crash );\n; \s;\c;goto ( pos, altitude );\n;
Tells the robot to go to the given position, avoiding all the obstacles if this is possible. Va à une certaine position, en évitant les obstacles tels que les autres robots, les bâtiments, les plans d'eau et les pentes trop raides.
\t;pos: \c;\l;point\u cbot\point;\n; \t;pos: \c;\l;point\u cbot\point;\n;
Coordinates of the goal position. Coordonnée de la position à atteindre.
\t;altitude: \c;\l;float\u cbot\float;\n; \t;altitude: \c;\l;float\u cbot\float;\n;
Flight altitude for \l;winged bots\u object\botgj;. The altitude is useful only for \l;winged bots\u object\botgj;. From the initial altitude, the bot climbs higher until it reaches the specified hight. When arriving close to destination, it goes down to touch the ground at the given position. If no value is given, an altitude of 10 meters is the default value. On very short moves, even winged bot stay on the ground. For all bot except winged bots, this parameter is ignored. Altitude moyenne pendant le déplacement, pour les \l;robots volants\u object\botgj;. Si ce paramètre est omis, une altitude de 12.5 mètres est automatiquement utilisée comme consigne. Lorsque le déplacement mesure moins de 20 mètres à vol d'oiseau, le robot reste au sol.
\t;goal: \c;\l;int\u cbot\int;\n; (default value \c;0\n;) \t;Valeur retournée: \c;\l;int\u cbot\int;\n;
This parameter tells the bot how it must reach the goal: Normalement, une erreur stoppe l'exécution du programme. Si l'instruction \c;goto\n; est précédée de \c;\l;errmode\u cbot\errmode;(0);\n;, une valeur nulle est retournée si tout est ok, ou valeur non nulle si une erreur est intervenue.
\c;0\n; stops exactly at the goal position \c;== 0 \n;position atteinte
\c;1\n; goes close to the goal position, without stopping. \c;!= 0 \n;impossible d'atteindre la position
If no value is given, \c;1\n; (precision) is the default value.
\t;Return value: \c;\l;int\u cbot\int;\n; \t;Dictionnaire anglais-français
Normally an error stops the program. You can prevent the program from stopping on errors by using the \c;\l;errmode\u cbot\errmode;(0)\n; instruction. A value different from zero if an error occurred is then returned by \c;goto()\n;. \c;go to\n; = aller à
\c;== 0 \n;Goal position reached
\c;!= 0 \n;Goal position impossible to reach
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,29 +1,33 @@
\b;Instruction \c;grab\n; \b;Instruction \c;grab\n;
The instruction \c;grab();\n; instructs the bot to use the operating arm to grab an object located on the ground, on the platform of a building or on the power cell location of a bot. L'instruction \c;grab();\n; permet de saisir avec la pince du bras manipulateur un objet qui se trouve au sol, sur l'emplacement arrière d'un robot ou sur le socle d'un bâtiment.
\b;Basic use \b;Utilisation courante
The instruction \c;grab();\n; written in this form grabs the object located in front of the bot. Here is a short program that grabs an object in front of the bot and drops it 5 meters further: L'instruction \c;grab();\n; écrite sous cette forme permet de saisir l'objet qui se trouve devant le robot. Voici par exemple comment saisir ce qui se trouve devant le robot et le poser 5m plus loin:
\c; \c;
\s; grab(); \s; grab();
\s; \l;move\u cbot\move;(5); \s; \l;move\u cbot\move;(5);
\s; \l;drop\u cbot\drop;(); \s; \l;drop\u cbot\drop;();
\n; \n;
\b;For specialists \b;Pour spécialistes
Syntax:
Syntaxe:
\s;\c;grab ( oper );\n; \s;\c;grab ( oper );\n;
This instruction appeals to the operating arm of a \l;grabber bot\u object\botgr;, in order to grab the closest object. Actionne le bras manipulateur du \l;robot déménageur\u object\botgr;, pour prendre l'objet le plus proche.
\t;oper: \c;\l;int\u cbot\int;\n; (default value\c;InFront\n;) \t;oper: \c;\l;int\u cbot\int;\n; (\c;InFront\n; par défaut)
Oper indicates where the bot should look for an object to grab. If no indication is given, the object is picked up in front of the bot. Position à atteindre avec la bras manipulateur. Si cette indication n'est pas fournie, on suppose qu'il s'agit du cas le plus fréquent où l'objet est pris ou déposé devant le robot.
\c;InFront \n; Grabs in front (default value). \c;InFront \n; Prend devant (par défaut).
\c;Behind \n; Grabs behind. \c;Behind \n; Prend derrière.
\c;EnergyCell\n; Grabs the bot's own power cell. \c;EnergyCell\n; Prend sa propre pile.
\t;Return value: \c;\l;int\u cbot\int;\n; \t;Valeur retournée: \c;\l;int\u cbot\int;\n;
Normally an error stops the program. You can prevent the program from stopping on errors by using the \c;\l;errmode\u cbot\errmode;(0)\n; instruction. A value different from zero if an error occurred is then returned by \c;grab();\n;. Normalement, une erreur stoppe l'exécution du programme. Si l'instruction \c;grab\n; est précédée de \c;\l;errmode\u cbot\errmode;(0);\n;, une valeur nulle est retournée si tout est ok, ou valeur non nulle si une erreur est intervenue.
\c;== 0 \n;an object was grabbed \c;== 0 \n;objet pris
\c;!= 0 \n;error, no object was grabbed \c;!= 0 \n;erreur, pas d'objet pris
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;grab\n; = saisir
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,26 +1,26 @@
\b;Instructions \c;if\n; and \c;else\n; \b;Instructions \c;if\n; et \c;else\n;
With the instruction \c;if() {}\n; you can execute a set of instructions only if a certain condition is true. Write the condition in brackets \c;()\n;, and the instructions in braces \c;{}\n;. L'instruction \c;if() {}\n; permet d'exécuter des instructions seulement à une certaine condition. La condition est donnée entre parenthèses \c;()\n;, les instructions entre accolades \c;{}\n;.
\b;Basic use \b;Utilisation courante
Here is a concrete example: The bot will shoot only if the target is closer than 40 meters: Voici par exemple comment faire en sorte que le robot tire seulement si la distance à la cible est inférieure à 40m:
\c; \c;
\s; item = \l;radar\u cbot\radar;(AlienAnt); \s; chose = \l;radar\u cbot\radar;(AlienAnt);
\s; if (\l;distance\u cbot\dist;(position, item.position) < 40) \s; if (\l;distance\u cbot\dist;(position, chose.position) < 40)
\s; { \s; {
\s; fire(1); \s; fire(1);
\s; } \s; }
\n; \n;
You can also test if an object exists at all. If the instruction \c;\l;radar\u cbot\radar;();\n; does not find the requested object, it returns the value \c;null\n;. So you can test if an object does not exists with the condition \c;(item == null)\n;, or test if it exists with \c;(item != null)\n;. Two equal signs \c;==\n; test equality, an exclamation mark followed by an equal sign \c;!=\n; test inequality. Here is a test that will go to rechage the \l;power cell\u object\power; only if there is a \l;power station\u object\station;: Si l'instruction \c;\l;radar\u cbot\radar;();\n; ne trouve pas l'objet cherché, elle rend la valeur \c;null\n;. Ainsi il est possible de tester si un objet n'existe pas avec \c;(chose == null)\n;, ou de tester si l'objet existe avec \c;(chose!= null)\n;. Deux signes égal \c;==\n; testent l'égalité, un point d'exclamation suivi d'un signe égal \c;!=\n; teste l'inégalité. Voici comment aller se recharger seulement s'il y a une station de recharge:
\c; \c;
\s; item = \l;radar\u cbot\radar;(PowerStation); \s; chose = \l;radar\u cbot\radar;(PowerStation);
\s; if (item != null) \s; if (chose!= null)
\s; { \s; {
\s; \l;goto\u cbot\goto;(item.position); \s; \l;goto\u cbot\goto;(chose.position);
\s; \l;wait\u cbot\wait;(5); \s; \l;wait\u cbot\wait;(5);
\s; } \s; }
\n; \n;
\b;For specialists \b;Pour spécialistes
Syntax: Syntaxe:
\s;\c;if ( condition ) \s;\c;if ( condition )
\s;{ \s;{
\s; \n;Instructions A ...\c; \s; \n;Instructions A ...\c;
@ -30,11 +30,15 @@ Syntax:
\s; \n;Instructions B ...\c; \s; \n;Instructions B ...\c;
\s;} \s;}
\n; \n;
With this conditional structure you can execute a \l;bloc\u cbot\bloc; A or a \l;bloc\u cbot\bloc; B depending on a \l;condition\u cbot\cond;. If the condition is true, bloc A is executed. If the condition is false, bloc B is executed. Cette structure de choix permet d'exécuter le \l;bloc\u cbot\bloc; A ou le \l;bloc\u cbot\bloc; B en fonction d'une \l;condition\u cbot\cond;. Si la condition est vraie, le bloc A est exécuté. Si elle est fausse, c'est le bloc B qui est exécuté.
Part \c;else { }\n; is not compulsory. La partie \c;else { }\n; est facultative.
\t;Attention \t;Attention
Do not put a \l;semicolon\u cbot\term; at the end of the line \c;if ( )\n;. Il ne faut pas mettre un \l;point-virgule\u cbot\term; à la fin de la ligne \c;if ( )\n;.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;if \n; = si
\c;else\n; = autrement
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,20 +1,22 @@
\b;Type \c;int\n; \b;Type \c;int\n;
Use this type for variables that contain only whole numbers, negative or positive. For example: Ce type permet de représenter des nombres entiers positifs ou négatifs. Par exemple:
\c; \c;
\s; 12 \s; 12
\s; 1000 \s; 1000
\s; -4 \s; -4
\n; \n;
To represent real numbers like 12.05 or -0.005, use the type \c;\l;float\u cbot\float;\n;. Pour représenter un nombre réel (12.05 ou -0.005 par exemple) il faut utiliser le type \c;\l;float\u cbot\float;\n;.
\t;Attention \t;Remarque
Do not put space or colon signs inside a number. Vous ne pouvez pas utiliser d'espace ou d'apostrophe dans un nombre.
\t;For specialists \t;Le coin du spécialiste
Numbers of the type \c;int\n; are represented with 32 bits. Sachez que ce type utilise 32 bits.
The highest number that can be represented is (2^31)-1, that is 2'147'483'647. La valeur maximale représentable est (2^31)-1, soit 2'147'483'647.
The smallest number that can be represented is -(2^31), that is -2'147'483'648. La valeur minimale représentable est -(2^31), soit -2'147'483'648.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;integer\n; = nombre entier
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,16 +1,17 @@
\b;Instruction \c;jet\n; \b;Instruction \c;jet\n;
Syntax: Syntaxe:
\s;\c;jet ( power );\n; \s;\c;jet ( power );\n;
Direct control of the jet of a \l;winged bot\u object\botgj;. The jet is what makes the bot fly. Use this instruction in order to take off, climb, descend or land. Commande directe du réacteur d'un \l;robot volant\u object\botgj;.
\t;power: \c;\l;float\u cbot\float;\n; \t;power: \c;\l;float\u cbot\float;\n;
Power of the jet, ranges between \c;-1\n; and \c;+1\n;. \c;jet(1);\n; instructs the bot to climb as fast as possible, \c;jet(-1);\n; descends as fast as possible, \c;jet(0);\n; stabilizes the altitude. In order to get slower altitude changes, use intermediate values, for example \c;jet(0.3);\n;. Puissance du réacteur, comprise entre \c;-1\n; et \c;1\n;. \c;jet(1);\n; fait monter le robot à la vitesse maximale, \c;jet(-1);\n; le fait descendre à la vitesse maximale, \c;jet(0);\n; lui fait garder son altitude actuelle. Pour obtenir des changements d'altitude plus doux, employez des valeurs intermédiaires, par exemple \c;jet(0.3);\n;.
\t;Valeur retournée: \c;\l;void\u cbot\void;\n;
Aucune.
\t;Return value: \c;\l;void\u cbot\void;\n; \t;Dictionnaire anglais-français
None. \c;jet\n; = avion à réaction
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,25 +1,32 @@
\b;Instruction \c;message\n; \b;Instruction \c;message\n;
Syntax: Syntaxe:
\s;\c;message ( text, type );\n; \s;\c;message ( texte, type );\n;
Prints a message on top of the screen. After a few seconds, the message disappears automatically. Affiche un message en haut de l'écran. Après quelques secondes, le message disparaît automatiquement.
\t;text: \c;\l;string\u cbot\string;\n; \t;texte: \c;\l;string\u cbot\string;\n;
Text that is to be displayed. It is possible to append several texts and/or values with the operator \c;+\n;: Texte à afficher. Il est possible d'appondre plusieurs textes et/ou valeurs en utilisant l'opérateur \c;+\n;:
\c;message("Not found");\n; \c;message("Pas trouvé");\n;
\c;message(angle);\n; \c;message(angle);\n;
\c;message(n + " object(s) found");\n; \c;message(n + " objet(s) trouvé(s)");\n;
\c;message("Distance = " + dist + " meters");\n; \c;message("Distance = " + dist + " mètres");\n;
\t;type: \c;\l;int\u cbot\int;\n; (default value \c;DisplayMessage\n;) \t;type: \c;\l;int\u cbot\int;\n; (\c;DisplayMessage\n; par défaut)
Type of the message, that determines the background color. Type du message, qui détermine la couleur de fond du texte.
o \c;DisplayMessage\n; Standard message on yellow background. o \c;DisplayMessage\n; Message standard sur fond jaune.
o \c;DisplayInfo \n; Information on green background. o \c;DisplayInfo \n; Information sur fond vert.
o \c;DisplayWarning\n; Warning on blue background. o \c;DisplayWarning\n; Avertissement sur fond bleu.
o \c;DisplayError \n; Error on red background. o \c;DisplayError \n; Erreur sur fond rouge.
\t;Return value: \c;\l;void\u cbot\void;\n; \t;Valeur retournée: \c;\l;void\u cbot\void;\n;
None. Aucune.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;message \n; = message
\c;display \n; = affichage
\c;information\n; = information
\c;warning \n; = avertisseement
\c;error \n; = erreur
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,39 +1,39 @@
\b;Instruction \c;motor\n; \b;Instruction \c;motor\n;
The instruction \c;motor( , );\n; sets the speed for the left-hand and the right-hand motor of the bot. L'instruction \c;motor( , );\n; permet de donner directement une vitesse aux moteurs gauche et droite du robot.
\b;Basic use \b;Utilisation courante
The speed given to the motors will remain constant during the execution of the following instructions. Thanks to this characteristic it is possible to perform a rotation during the instruction \c;\l;fire\u cbot\fire;();\n;. This will sweep a whole zone with only one burst. Here is an example that will sweep the zone in front of the bot: \c;motor( , );\n; conserve la vitesse du moteur pendant l'exécution des instructions suivantes. Ceci est utile pour faire tourner le robot pendant l'instruction \c;\l;fire\u cbot\fire;();\n;. Ainsi, il est possible de balayer toute une zone avec la rafale. Voici par exemple comment balayer toute la zone qui se trouve devant le robot:
\c; \c;
\s; \l;turn\u cbot\turn;(45); // turns 45 degrees left \s; \l;turn\u cbot\turn;(45); // tourne à gauche de 45 degrés
\s; motor(0.5, -0.5); // slow rotation to the right \s; motor(0.5, -0.5); // rotation lente à droite
\s; \l;fire\u cbot\fire;(2); // fire \s; \l;fire\u cbot\fire;(2); // feu
\s; motor(0,0); // stops the rotation \s; motor(0,0); // immobilise le robot
\n; \n;
With the left-hand motor turning half-speed forward and the right-hand motor turning half-speed backward, the bot will turn slowly on itself during the 2-second-burst. En faisant avancer le moteur gauche à demi-vitesse et en faisant reculer le moteur de droite à demi-vitesse, le robot tourne lentement sur lui-même pendant la rafale de 2 secondes.
\b;For specialists \b;Pour spécialistes
Syntax : Syntaxe:
\s;\c;motor ( left, right );\n; \s;\c;motor ( left, right );\n;
Gives speed instructions to the right and left motors of the robot. The motors will keep this speed until a new motor instruction is performed, or until a \c;\l;move\u cbot\move;\n;, \c;\l;turn\u cbot\turn;\n; or \c;\l;goto\u cbot\goto;\n; instruction is performed. Donne une consigne de vitesse aux deux moteurs gauche et droite du robot. La vitesse restera constante, jusqu'à ce qu'une nouvelle consigne soit donnée, ou jusqu'à l'utilisation d'une instruction \c;\l;move\u cbot\move;\n;, \c;\l;turn\u cbot\turn;\n; ou \c;\l;goto\u cbot\goto;\n;.
\t;left: \c;\l;float\u cbot\float;\n; \t;left: \c;\l;float\u cbot\float;\n;
Speed instruction for the left motor; the value must range between -1 and 1. Consigne pour le moteur gauche, comprise entre -1 et 1.
\t;right: \c;\l;float\u cbot\float;\n; \t;right: \c;\l;float\u cbot\float;\n;
Speed instruction for the right motor; the value must range between -1 and 1. Consigne pour le moteur droite, comprise entre -1 et 1.
Examples : Exemples:
\c;motor(1, 1);\n; moves forward with highest possible speed. \c;motor(1, 1);\n; pour avancer tout droit à la vitesse maximale.
\c;motor(-0.5, -0.5);\n; moves backward with half speed. \c;motor(0.5, 0.6);\n; pour avancer à mi-vitesse en tournant légèrement à gauche.
\c;motor(1, -1);\n; turns right as fast as possible. \c;motor(-0.5, -0.5);\n; pour reculer à mi-vitesse.
\c;motor(1, -1);\n; pour tourner à droite le plus vite possible.
Note : \t;Valeur retournée: \c;\l;void\u cbot\void;\n;
\c;motor(2, 2);\n; will not move forward any faster than \c;motor(1, 1)\n; Aucune.
\c;motor(-2, -2);\n; will not move backward any faster than \c;motor(-1, -1)\n;
\t;Return value: \c;\l;void\u cbot\void;\n; \t;Dictionnaire anglais-français
None. \c;motor\n; = moteur
\t;See also \t;Voir aussi
\l;Instructions\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,22 +1,25 @@
\b;Instruction \c;move\n; \b;Instruction \c;move\n;
The instruction \c;move();\n; instructs the bot to move forward or backward while keeping the same orientation. In brackets you must specify the length of the move in meters. L'instruction \c;move();\n; fait se déplacer le robot d'une longueur donnée en mètres.
\b;Basic use \b;Utilisation courante
If you want the bot to move forward 30 meters, write \c;move(30);\n;. In order to move the bot backward after it dropped a chunk of \l;titanium ore\u object\titanore; on the \l;converter\u object\convert;, write \c;move(-2.5);\n;. Pour faire avancer le robot de 30m, écrivez \c;move(30);\n;. Pour faire reculer le robot après avoir posé un \l;minerai de titanium\u object\titanore; sur le \l;convertisseur\u object\convert;, écrivez \c;move(-2.5);\n;.
\b;For specialists \b;Pour spécialistes
Syntax: Syntaxe:
\s;\c;move ( length );\n; \s;\c;move ( length );\n;
Moves forward or backward of a given distance, always keeping the current orientation of the bot. Avance d'une certaine distance, dans la direction actuelle.
\t;length: \c;\l;float\u cbot\float;\n; \t;length: \c;\l;float\u cbot\float;\n;
Length of the move, in meters. A negative value makes the bot move backward. Longueur à avancer, en mètres. Une longueur négative fait reculer le robot.
\t;Return value: \c;\l;int\u cbot\int;\n; \t;Valeur retournée: \c;\l;int\u cbot\int;\n;
Normally an error stops the program. You can prevent the program from stopping on errors by using the \c;\l;errmode\u cbot\errmode;(0)\n; instruction. A value different from zero if an error occurred is then returned by \c;move()\n;. Normalement, une erreur stoppe l'exécution du programme. Si l'instruction \c;move\n; est précédée de \c;\l;errmode\u cbot\errmode;(0);\n;, une valeur nulle est retournée si tout est ok, ou valeur non nulle si une erreur est intervenue.
\c;== 0 \n;Move executed \c;== 0 \n;déplacement effectué
\c;!= 0 \n;error, the instruction was not performed correctly \c;!= 0 \n;déplacement impossible
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;move\n; = déplacer
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,16 +1,14 @@
\b;Type \c;nan\n; \b;Type \c;nan\n;
This special value indicates that a \l;variable\u cbot\var; of type \c;\l;int\u cbot\int;\n; or \c;\l;float\u cbot\float;\n; contains no number, but "nothing". Cette valeur spéciale indique qu'une \l;variable\u cbot\var; de type \c;\l;int\u cbot\int;\n; ou \c;\l;float\u cbot\float;\n; ne contient pas un nombre, mais "rien".
For example, if the instruction \c;\l;receive\u cbot\receive;\n; can not get the requested information, it returns \c;nan\n; : Par exemple, lorsque l'instruction \c;\l;receive\u cbot\receive;\n; n'arrive pas à recevoir l'information demandée, elle retourne \c;nan\n;:
\c; \c;
\s; value = receive("Length"); \s; value = receive("Longueur");
\s; if ( value == nan ) // not found ? \s; if ( value == nan ) // pas trouvé?
\s; { \s; {
\s;
\s; } \s; }
\n; \n;
\t;Dictionnary \t;Dictionnaire anglais-français
\c;nan\n; = Not A Number \c;nan\n; (not a number) = pas un nombre
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,21 +1,19 @@
\b;Instruction \c;new\n; (for specialists) \b;Instruction \c;new\n; (pour spécialistes)
The \c;new\n; operator creates a \l;class\u cbot\class; instance: Une instance de \l;classe\u cbot\class; peut être créée par l'opérateur \c;new\n;:
\c;\s; MyClass item; // now item is a null reference \c;\s; MaClasse item; // item vaut null
\s; item = new MyClass(); // now item is a reference \s; item = new MaClasse();
\s; // to a new class instance
\n; \n;
If you want to create a new instance at declaration time you can ommit the new \c;new\n; operator by putting () after the declaration: Lorsque l'instance est créée en même temps que la déclaration, il est possible de simplifier l'écriture:
\c;\s; MaClasse item = new MaClasse();
\s; MaClasse item(); // identique
\n;
Si, par exemple, la classe contient un constructeur avec deux paramètres numériques, il est possible d'écrire:
\c;\s; MaClasse item = new MaClasse(2, 3);
\s; MaClasse item(2, 3); // identique
\n;
\t;Dictionnaire anglais-français
\c;new\n; = nouveau
Instead of: \t;Voir aussi
\c;\s; MyClass item = new MyClass(); \l;Références\u cbot\pointer;
\n;you can write: \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.
\c;\s; MyClass item();
\n;
If your class has a constructor with parameters you can write:
\c;\s; MyClass item = new MyClass(2, 3);
\n;or:
\c;\s; MyClass item(2, 3);
\n;
\t;See also
\c;\l;class\u cbot\class;\n;, \c;\l;reference\u cbot\pointer;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

View File

@ -1,7 +1,5 @@
\b;Type \c;null\n; \b;Type \c;null\n;
This special value indicates that the variable containing it does not reference an instance. Cette valeur spéciale indique un objet qui n'existe pas.
\t;See also
\l;References\u cbot\pointer;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,70 +1,89 @@
\b;Type \c;object\n; \b;Type \c;object\n;
Use this type for variables that contain the characteristics of an object, be it a bot, a building, some raw material, an enemy, etc. Ce type permet de représenter les caractéristiques d'un objet, qu'il s'agisse d'un robot, d'un bâtiment, d'une matière première transportable, d'un ennemi, etc.
\c;\l;int\u cbot\int; object.category \n;\l;Category\u cbot\category; of the object \c;\l;int\u cbot\int; object.category \n;\l;Catégorie\u cbot\category; de l'objet
\c;\l;point\u cbot\point; object.position \n;Position of the object (x,y,z) \c;\l;point\u cbot\point; object.position \n;Position de l'objet (x,y,z)
\c;\l;float\u cbot\float; object.orientation \n;Orientation of the object (0..360) \c;\l;float\u cbot\float; object.orientation \n;Orientation de l'objet (0..360)
\c;\l;float\u cbot\float; object.pitch \n;Forward/backward angle of the object \c;\l;float\u cbot\float; object.pitch \n;Inclinaison avant/arrière de l'objet
\c;\l;float\u cbot\float; object.roll \n;Right/left angle of the object \c;\l;float\u cbot\float; object.roll \n;Inclinaison latérale de l'objet
\c;\l;float\u cbot\float; object.energyLevel \n;Energy level (0..1) \c;\l;float\u cbot\float; object.energyLevel \n;Niveau d'énergie (0..1)
\c;\l;float\u cbot\float; object.shieldLevel \n;Shield level (0..1) \c;\l;float\u cbot\float; object.shieldLevel \n;Niveau du bouclier (0..1)
\c;\l;float\u cbot\float; object.temperature \n;Jet temperature (0..1) \c;\l;float\u cbot\float; object.temperature \n;Température du réacteur (0..1)
\c;\l;float\u cbot\float; object.altitude \n;Altitude above ground \c;\l;float\u cbot\float; object.altitude \n;Altitude par rapport au sol
\c;\l;float\u cbot\float; object.lifeTime \n;Lifetime of the object \c;\l;float\u cbot\float; object.lifeTime \n;Durée de vie de l'objet
\c;object object.energyCell \n;Power cell on the bot \c;object object.energyCell \n;Objet pile
\c;object object.load \n;Object carried by the bot \c;object object.load \n;Objet transporté
\s;\c;category\n; \s;\c;category\n;
The \n;\l;category\u cbot\category; of an object allows you to know what it is, f. ex. what kind of bot, building, enemy, etc. La \n;\l;catégorie\u cbot\category; de l'objet permet de savoir s'il s'agit d'un robot, d'un bâtiment, d'un ennemi, etc.
\s;\c;position\n; \s;\c;position\n;
Position of the object on the planet, in meters. The coordinates \c;x\n; and \c;y\n; correspond to the location on a map, the \c;z\n; coordinate corresponds to the altitude above (respectively below) sea level. Position de l'objet sur la planète, en mètres. Les coordonnées \c;x\n; et \c;y\n; correspondent à la position à plat, alors que \c;z\n; correspond à l'élévation absolue par rapport au niveau de la mer.
\s;\c;orientation\n; \s;\c;orientation\n;
Orientation of the object, in degrees. The orientation tells you what direction the object is facing. An orientation of \c;0\n; corresponds to an object facing eastwards, thus following the positive \c;x\n; axis. The orientation is measured counterclockwise. Orientation de l'objet, en degrés. Une orientation de \c;0\n; correspond à un objet tourné vers l'est, donc vers l'axe \c;x\n; positif. Le sens de l'orientation est anti-horaire.
\s;\c;pitch\n; \s;\c;pitch\n;
Forward/backward angle of the robot. A pitch of \c;0\n; means that the bot is standing on flat ground. A positive inclination means that it is facing upwards, a negative inclination means that it is facing downwards. Inclinaison avant/arrière de l'objet, en degrés. Une valeur positive indique que le robot monte.
\s;\c;roll\n; \s;\c;roll\n;
Left/right angle of the bot, in degrees. A positive value means that the bot is leaning to the left side, a negative value means that it is leaning to the right side. Inclinaison latérale de l'objet, en degrés. Une valeur positive indique que le robot penche à gauche.
\s;\c;energyLevel\n; \s;\c;energyLevel\n;
Energy level, between 0 and 1. A normal \l;power cell\u object\power; that is fully charged returns the value \c;1\n;. A \l;nuclear power cell\u object\atomic; never returns a value higher than 1, it just lasts longer. Attention: The energy level of a bot is always zero, because the energy is not contained in the bot, but in the power cell. To know the energy level of the power cell of a bot, you must write \c;energyCell.energyLevel\n;. Niveau d'énergie. Une \l;pile normale\u object\power; entièrement pleine donne la valeur \c;1\n;. Une \l;pile atomique\u object\atomic; ne dépasse jamais le niveau \c;1\n;; elle dure simplement plus longtemps.
Notez que le niveau d'énergie d'un robot est toujours nul. En effet, l'énergie est contenue dans la pile qui est placée à l'arrière du robot, et non dans le robot lui-même. Il faut donc écrire \c;energyCell.energyLevel\n; pour connaître l'énergie à disposition.
\s;\c;shieldLevel\n; \s;\c;shieldLevel\n;
Shield level of a robot or building. A level \c;1\n; indicates that the shield is still perfect. Every time that the bot or building gets a bullet or collides with another object, the shield level decreases. When the level reaches \c;0\n;, the next bullet or collision will destroy the bot or building. Niveau du bouclier du robot ou du bâtiment. Un niveau de \c;1\n; correspond à un bouclier en parfait état. Avec un niveau de \c;0\n;, le prochain choc ou tir ennemi sera fatal.
Bots can re-energize their shield on a \l;repair center\u object\repair;. The shield of a building is repaired if it lays inside the protection sphere of a \l;shielder\u object\botshld;. Les robots peuvent régénérer leurs boucliers sur le \l;centre de réparation\u object\repair;. Le bouclier d'un bâtiment est régénéré s'il se trouve dans la sphère protectrice du \l;robot bouclier\u object\botshld;.
\s;\c;temperature\n; \s;\c;temperature\n;
Temperature of the jet of \l;winged bots\u object\botgj;. \c;0\n; corresponds to a cold jet. When used, the temperature increases progressively. When it reaches the value \c;1\n;, the jet is overheated and stops working, until it cooled down a little. Température du réacteur pour les \l;robots volants\u object\botgj;. \c;0\n; correspond à un réacteur froid et \c;1\n; à un réacteur bouillant, provisoirement hors d'usage.
\s;\c;altitude\n; \s;\c;altitude\n;
The \c;z\n; coordinate of the position indicates the altitude above sea level, whereas the \c;altitude\n; indicates the height above ground. This value is meaningful only for \l;winged bots\u object\botgj; and for \l;wasps\u object\wasp;. For all other objects, this value is zero. Contrairement à la position \c;z\n; qui est absolue, l'altitude est relative au niveau du sol. L'altitude n'a de sens que pour les \l;robots volants\u object\botgj; et la \l;guêpe\u object\wasp;. Pour tous les autres robots ou pour les bâtiments, cette valeur est nulle.
\s;\c;lifeTime\n; \s;\c;lifeTime\n;
The age of the object in seconds since it's creation. Donne l'âge de l'objet, en secondes.
\s;\c;energyCell\n; \s;\c;energyCell\n;
This information is special, because it returns the information about another object, in this case the power pack. This means that energyCell contains all the characteristics of a normal object, for example \c;category\n; (PowerCell or NuclearCell), \c;position\n; (the position of the cell), etc. Cette information est spéciale, dans la mesure où elle contient les caractéristiques d'un autre objet, la pile en l'occurrence. On y retrouve donc toutes les caractéristiques de l'objet de base, telles que \c;category\n;, \c;position\n;, etc.
If you want to know the energy level of a robot, you must not check \c;energyLevel\n;, but \c;energyCell.energyLevel\n;. Pour connaître le niveau d'énergie d'un robot, il ne faut pas accéder à \c;energyLevel\n;, mais à \c;energyCell.energyLevel\n;.
If the bot has bot no power cell, \c;energyCell\n; returns \c;null\n;. Si le robot n'a pas de pile, \c;energyCell\n; vaut \c;null\n;.
\s;\c;load\n; \s;\c;load\n;
This information also returns the description of a whole object: the description of the object carried by a \l;grabber\u object\botgr;. If it carries nothing, \c;load\n; returns \c;null\n;. Cette information est spéciale, comme la précédente. Elle contient les caractéristiques de l'objet transporté par le \l;robot déménageur\u object\botgr;. S'il ne transporte rien, \c;load\n; vaut \c;null\n;.
\b;Examples \b;Exemples
The type \c;object\n; returns the special value \c;\l;null\u cbot\null;\n; when the object does not exist. For example: Le type \c;object\n; prend la valeur particulière \c;\l;null\u cbot\null;\n; lorsque l'objet n'existe pas. Par exemple:
\c; \c;
\s; object a; \s; object a;
\s; a = radar(BotGrabberRoller); \s; a = radar(BotGrabberRoller);
\s; if ( a == null ) // object does not exist ? \s; if ( a == null ) // objet n'existe pas?
\s; { \s; {
\s; } \s; }
\s; if ( a.position.z > 50 ) // is it on a mountain ? \s; if ( a.position.z > 50 ) // sur une hauteur?
\s; { \s; {
\s; } \s; }
\n; \n;
\t;See also Les informations \c;energyCell\n; et \c;load\n; sont spéciales: on y retrouve donc toutes les caractéristiques de l'objet de base, telles que \c;category\n;, \c;position\n;, etc.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. Par exemple, \c;category\n; contient la catégorie du robot, alors que \c;energyCell.category\n; contient la catégorie de la pile du robot.
Pour connaître le niveau d'énergie d'un robot, il ne faut pas accéder à \c;energyLevel\n;, mais à \c;energyCell.energyLevel\n;.
\c;
\s; object a;
\s; a = radar(BotGrabberRoller);
\s; if ( a.load!= null ) // porte qq chose?
\s; {
\s; }
\s; if ( a.load.category == PowerCell ) // porte une pile?
\s; {
\s; }
\s; if ( a.energyCell.energyLevel < 0.2 ) // presque à plat?
\s; {
\s; }
\n;
\t;Dictionnaire anglais-français
\c;object\n; = objet
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,20 +1,25 @@
\b;Instruction \c;open\n; \b;Instruction \c;open\n;
Open a text file in the files/ folder. This is a method of the \c;\l;file\u cbot\file;\n; class. This is the reason why we always write \c;handle.open()\n;¦: L'instruction \c;open();\n; ouvre un fichier de texte dans le dossier files/. Cette instruction est une méthode de la classe \c;\l;file\u cbot\file;\n;. C'est la raison pour laquelle on n'écrit jamais \c;open()\n; tout seul, mais \c;handle.open()\n;:
\c; \c;
\s; handle.open("test.txt", "w"); \s; handle.open("essai.txt", "w");
\n; \n;
To open a file, proceed as follows¦: Pour ouvrir un fichier, procédez comme suit:
\c; \c;
\s; file handle(); \s; file handle();
\s; handle.open("filename", "w"); \s; handle.open("filename", "w");
\s; handle.writeln("abc"); \s; handle.writeln("abc");
\s; handle.close(); \s; handle.close();
\n; \n;
\c;"r"\n; mode: open for reading. Le mode \c;"r"\n; permet d'ouvrir le fichier en lecture (read).
\c;"w"\n; mode: open for writing. Le mode \c;"w"\n; permet d'ouvrir le fichier en écriture (write).
Files can only be created and opened in the files/ folder which is located in the folder where Colobot has been installed. You cannot not create or open files that are located elsewhere than in the files/ folder. \t;Dictionnaire anglais-français
\c;file \n; = fichier
\c;handle \n; = poignée, manipuler
\c;open \n; = ouvre
\c;close \n; = ferme
\c;writeln\n; = abréviation de "write line", écrit une ligne
\t;See also \t;Voir aussi
\c;\l;file\u cbot\file;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;readln\u cbot\readln;\n;, \c;\l;writeln\u cbot\writeln;\n; and \c;\l;eof\u cbot\eof;\n;. \c;\l;file\u cbot\file;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;readln\u cbot\readln;\n;, \c;\l;writeln\u cbot\writeln;\n; et \c;\l;eof\u cbot\eof;\n;.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,11 +1,15 @@
\b;Instruction \c;openfile\n; \b;Instruction \c;openfile\n;
\c;openfile();\n; opens an text file in the files/ folder. This is not a method of the \c;\l;file\u cbot\file;\n; class but openfile returne a \l;reference\u cbot\pointer; to a new instance of the file class. You must supply two parameters, the filename and the opening mode. L'instruction \c;openfile();\n; ouvre un fichier de texte dans le dossier files/. Elle ne fait pas partie de la classe \c;\l;file\u cbot\file;\n; mais retourne une \l;référence\u cbot\pointer; à une instance de cette classe avec le fichier ouvert. Cette fonction demande deux paramètres: le nom du fichier et le mode d'ouverture.
\c; \c;
\s;file handle = openfile("filename", "r"); \s;file handle = openfile("filename", "r");
\n; \n;
\c;"r"\n; mode: open for reading. Le mode \c;"r"\n; permet d'ouvrir le fichier en lecture (read).
\c;"w"\n; mode: open for writing. Le mode \c;"w"\n; permet d'ouvrir le fichier en écriture (write).
\t;Dictionnaire anglais-français
\c;file \n; = fichier
\c;handle\n; = poignée, manipuler
\c;open \n; = ouvre
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,36 +1,38 @@
\b;Type \c;point\n; \b;Type \c;point\n;
Variables of this type contain the coordinates of a point in space. This type is made of three values that represent the \c;x\n;, \c;y\n; and \c;z\n; coordinates. Ce type permet de représenter les coordonnées d'un point dans l'espace. Ce type contient en fait 3 nombres réels, pour les coordonnées \c;x\n;, \c;y\n; et \c;z\n;.
\c;x\n; and \c;y\n; correspond to the place on the ground. The positive \c;x\n; axis faces towards east, the positive \c;y\n; axis faces towards north. \c;x\n; et \c;y\n; correspondent à la position sur le sol, à plat. \c;x\n; positif va en direction de l'est et \c;y\n; positif va en direction du nord.
The \c;z\n; value corresponds to the altitude above sea level. \c;z\n; correspond à l'élévation.
If you want to declare a variable of type point, you can write: Pour déclarer et initialiser un point, vous pouvez écrire:
\c; \c;
\s; point a (10, 20, 30); \s; point a (10, 20, 30);
\n; \n;
You can also set the variable taking one value after another: Il est possible d'accéder à une coordonnée particulière avec:
\c; \c;
\s; point b; \s; point b;
\s; b.x = 10; \s; b.x = 10;
\s; b.y = 20; \s; b.y = 20;
\s; b.z = 30; \s; b.z = 30;
\n; \n;
With these examples, the following \l;condition\u cbot\cond; is true: Avec ces deux exemples, la \l;condition\u cbot\cond; suivante est vraie:
\c; \c;
\s; if ( a == b ) \s; if ( a == b )
\s; { \s; {
\s; } \s; }
\n; \n;
The following declaration : La déclaration suivante:
\c; \c;
\s; point c (4, 7); \s; point c (4, 7);
\n; \n;
Is equivalent to : Est équivalente à:
\c; \c;
\s; point c; \s; point c;
\s; c.x = 4; \s; c.x = 4;
\s; c.y = 7; \s; c.y = 7;
\s; c.z = 0; \s; c.z = 0;
\n; \n;
\t;Dictionnaire anglais-français
\c;point\n; = point
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,53 +1,42 @@
\b;References (for specialists) \b;Les références (pour spécialistes)
CBOT uses references for \l;classes\u cbot\class; and \l;arrays\u cbot\array;. Any class variable actually contains a reference to the instance. The instance actually contains the class fields. Several references can reference the same instance. A \c;\l;null\u cbot\null;\n; reference references nothing. You can compare an instance to a suitcase and a reference to a carrier. Each time we need a new suitcase we create a new instance with a carrier. But a suitcase can be carried by more than one carrier. A carrier who carries no suitcase is a \c;\l;null\u cbot\null;\n; reference. CBOT travaille avec des références aux instances de \l;classes\u cbot\class; et aux \l;tableaux\u cbot\array;. Une instance est un élément physique contenant les informations liées à la classe. On peut comparer cela à une petite valise avec des conteneurs correspondants à la description de la classe. A chaque fois que l'on a besoin d'une nouvelle valise pour y mettre quelque chose, il faut créer une nouvelle instance. Les références, quant à elles, peuvent être considérées comme les porteurs de ces valises, à cela prêt qu'il y a souvent plusieurs porteurs pour la même valise. Une référence \c;\l;null\u cbot\null;\n; ne référence rien; c'est comparable à un porteur sans valise.
Le fait qu'une instance à une classe soit créée automatiquement (\c;\l;new\u cbot\new;\n; sous-entendu) ne change pas ce concept. On peut donc copier une référence dans une autre et avoir plusieurs références vers une même instance:
Example:
\c;\s;{ \c;\s;{
\s; MyClass item1(); // create a new instance \s; MaClasse item1(); // crée une instance
\s; // referenced by item1 \s; MaClasse item2; // crée une référence nulle
\s; MyClass item2; // create a null reference \s; item2 = item1; // copie la référence
\s; item2 = item1; // copy the reference, \s; item1.a = 12; // modifie aussi item2
\s; // item2 and item1 now reference \s; message(item2.a); // affiche 12
\s; // the same instance
\s; item1.a = 12; // modifies the instance
\s; // referenced by item1 (and item2)
\s; message(item2.a);// displays 12
\s;} \s;}
\n; \n;
If you pass a \l;class\u cbot\class; instance as parameter to a function, the function only receives a reference to the instance. That means if you modify the instance in the function, the instance that has been specified by the caller will be actuallay modified. En passage de paramètre, c'est toujours la référence qui est donnée à la \l;fonction\u cbot\function;:
\c;\s;void Test( MaClasse item )
\c;\s;void Test( MyClass item )
\s;{ \s;{
\s; item.a = 12; // modify the original instance \s; item.a = 12; // modifie l'instance d'origine
\s; item = new MyClass(); // new local instance \s; item = new MaClasse(); // nouvelle instance locale
\s; item.a = 33; // modifie the local instance \s; item.a = 33; // modifie l'instance locale
\s;} \s;}
\n; \n;Un appel à cette fonction va donner cela:
Calling the fucntion \c;Test()\n;¦:
\c;\s;{ \c;\s;{
\s; MyClass toto(); \s; MaClasse toto();
\s; Test(toto); \s; Test(toto);
\s; message(toto.a); // displays 12 \s; message(toto.a); // toto.a vaut 12
\s;} \s;}
\n; \n;En effet, l'instance avec le résultat \c;33\n; n'était pointée que par \c;item\n; dans la fonction \c;Test\n;. A la sortie de \c;Test\n;, la référence \c;item\n; disparaît et l'instance qu'elle pointait n'a plus de raison d'être.
The instance containing the field \c;a = 33\n; is referenced only by the newly created instance \c;item\n; inside the fucntion \c;Test\n;. At the end of \c;Test\n; this newly created instance referenced by \c;item\n; is automatically deleted.
A function can return an instance¦: Une \l;fonction\u cbot\function; peut rendre une instance en sortie. Pour cela, il faut la définir ainsi:
\c;\s;MyClass Test2( ) \c;\s;MaClasse Test2( )
\s;{ \s;{
\s; MyClass item = new MyClass(); \s; MaClasse item = new MaClasse();
\s; item.x = 33; \s; item.x = 33;
\s; return item; \s; return item;
\s;} \s;}
\n; \n;L'appel à cette fonction se fait alors ainsi:
Call the function like this:
\c;\s;{ \c;\s;{
\s; MyClass toto; \s; MaClasse toto;
\s; toto = Test2(); // toto will contain a reference to \s; toto = Test2();
\s; // the instance created by Test2() \s; message(toto.a); // affiche 33
\s; message(toto.a); // displays 33
\s;} \s;}
\n; \n;
\t;See also \t;Voir aussi
\c;\l;class\u cbot\class;\n;, \c;\l;new\u cbot\new;\n; \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

View File

@ -1,19 +1,19 @@
\b;Instruction \c;private\n; (for specialists) \b;Instruction \c;private\n; (pour spécialistes)
\l;Class\u cbot\class; members can be \l;public\u cbot\public; (by default) or private. A member can be declared privat by putting \c;private\n; before the type declaration of the member. Private members are not accessible from outside the class definition. Les éléments déclarés dans une \l;classe\u cbot\class; peuvent être \l;publics\u cbot\public; (par défaut) ou privés. Un élément est privé en plaçant \c;private\n; devant le type de l'élément. Dès lors, ces éléments ne seront plus accessibles depuis l'extérieur de la définition de la classe elle-même.
\c; \c;
\s;public class MyClass \s;public class MaClasse
\s;{ \s;{
\s; int b; // public by défault \s; int b; // public par défaut
\s; public int a; // als public \s; public int a; // public aussi
\s; private point position; // privat \s; private point position; // privé
\s;} \s;}
\s;void Test() \s;void Test()
\s;{ \s;{
\s; MyClass item; \s; MaClasse item;
\s; item.a = item.b = 12; // ok \s; item.a = item.b = 12; // ok
\s; message( item.position ); // this is an error \s; message( item.position ); // erreur élément non accessible
\s;} \s;}
\n; \n;
\t;See also \t;Voir aussi
\c;\l;class\u cbot\class;\n;, \c;\l;public\u cbot\public;\n; \c;\l;class\u cbot\class;\n;, \c;\l;public\u cbot\public;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,13 +1,12 @@
\b;Instruction \c;public\n; (for specialists) \b;Instruction \c;public\n; (pour spécialistes)
This instruction has two distinct purposes¦: Cette instruction a deux rôles distincts:
1) Make a function available to other bots. 1) Rendre une fonction accessible de tous les robots.
2) Make a class member accessible from outside the class definition. 2) Rendre une méthode d'une classe accessible de l'extérieur.
\b;Instruction \c;public\n; for functions \b;Instruction \c;public\n; pour les fonctions
If you put \c;public\n; before a \l;function\u cbot\function; definition, you can make the function available to programs in other bots in the same mission. La présence de ce mot rend la \l;fonction\u cbot\function; disponible partout dans la mission. Cette fonction peut alors être utilisée dans le programme d'un autre robot.
Par exemple, dans un premier robot:
For example in the first bot we would have¦:
\c; \c;
\s;public void object::Segment(float dist, float angle) \s;public void object::Segment(float dist, float angle)
\s;{ \s;{
@ -15,7 +14,7 @@ For example in the first bot we would have¦:
\s; turn(angle); \s; turn(angle);
\s;} \s;}
\n; \n;
And in another bot we would have¦: Et dans un autre robot:
\c; \c;
\s;extern void object::Square( ) \s;extern void object::Square( )
\s;{ \s;{
@ -26,26 +25,25 @@ And in another bot we would have¦:
\s; } \s; }
\s;} \s;}
\n; \n;
If you have declared a function \c;public\n;, you cannot define a function with the same name and arguments in another bot of the same mission. Il ne peut y avoir qu'une seule fonction ayant le même nom, parmi tous les programmes des robots de la mission en cours.
Si le robot qui contenait la fonction déclarée \c;public\n; est détruit, les autres robots qui utilisent cette fonction sont stoppés sur une erreur!
If a bot containing a \c;public\n; function is destroyed, the other bots that make use of this function will be stopped with an error. \b;Instruction \c;public\n; pour les classes
Les éléments déclarés dans une \l;classe\u cbot\class; peuvent être publics (par défaut) ou \l;privés\u cbot\private;. Un élément est privé en plaçant \c;private\n; devant le type de l'élément. Dès lors, ces éléments ne seront plus accessibles depuis l'extérieur de la définition de la classe elle-même.
\b;Instruction \c;public\n; for classes
\l;Class\u cbot\class; members can be public (by default) or \l;privat\u cbot\private;. A member can be declared private by putting \c;private\n; before the member type. Private members are not accessible from outside the class definition.
\c; \c;
\s;public class MyClass \s;public class MaClasse
\s;{ \s;{
\s; int b; // public by default \s; int b; // public par défaut
\s; public int a; // also public \s; public int a; // public aussi
\s; private point position; // privat \s; private point position; // privé
\s;} \s;}
\s;void Test() \s;void Test()
\s;{ \s;{
\s; MyClass item; \s; MaClasse item;
\s; item.a = item.b = 12; // ok \s; item.a = item.b = 12; // ok
\s; message( item.position ); // this is an error \s; message( item.position ); // erreur
\s;} \s;}
\n; \n;
\t;See also \t;Voir aussi
\c;\l;class\u cbot\class;\n;, \c;\l;private\u cbot\private;\n;, \c;\l;functions\u cbot\function;\n; \c;\l;class\u cbot\class;\n;, \c;\l;private\u cbot\private;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,60 +1,59 @@
\b;Instruction \c;radar\n; \b;Instruction \c;radar\n;
With the instruction \c;radar()\n;, you can look for objects like \l;enemies\u object\mother;, bots, buildings or raw materials. Avec l'instruction \c;radar()\n;, le robot peut chercher des objets comme des \l;ennemis\u object\mother;, des robots ou des bâtiments.
\b;Basic use \b;Utilisation courante
Write in brackets the \l;name of the object\u cbot\category; that you look for. Put the result in a variable of the \l;type\u cbot\type; \c;object\n;. Here is an example that looks for the closest ant: Donnez entre parenthèses le \l;nom de l'objet\u cbot\category; que vous cherchez. Mettez le résultat dans une variable de \l;type\u cbot\type; \c;object\n;. Voici par exemple comment chercher la fourmi la plus proche:
\c; \c;
\s;// At the beginning of the program: \s;// Tout au début du programme:
\s;object item; // variable declaration \s;object chose; // déclaration de la variable
\s; \s;
\s;// Look for the closest ant \s;// Cherche la fourmi la plus proche
\s;item = radar(AlienAnt); \s;chose = radar(AlienAnt);
\n; \n;
\b;For specialists \b;Pour spécialistes
Syntax: Syntaxe:
\s;\c;radar ( category, angle, focus, min, max, way );\n; \s;\c;radar ( catégorie, angle, focus, min, max, sens );\n;
Detects an object according to several parameters. Détecte un objet selon divers critères.
\image radar1 8 8; \image radar1 8 8;
Seen from above, the purple zone corresponds to the zone where objects will be detected. La zone arrondie violette correspond, vue d'en haut, à la zone dans laquelle les objets sont détectés.
\t;category: \c;\l;int\u cbot\int;\n; \t;catégorie: \c;\l;int\u cbot\int;\n;
\l;Category\u cbot\category; of the objects that should be detected. For example, when you are looking for an ant, write \c;radar (AlienAnt)\n;. \l;Catégorie\u cbot\category; des objets cherchés. Par exemple, \c;WayPoint\n;.
\t;angle: \c;\l;float\u cbot\float;\n; (default value\c;0\n;) \t;angle: \c;\l;float\u cbot\float;\n; (\c;0\n; par défaut)
Direction that the radar is facing, in degrees. Direction dans laquelle est dirigé le radar, en degrés.
\c; 0\n; -> radar is facing straight ahead \c; 0\n; -> radar dirigé droit devant
\c;-90\n; -> radar is facing a quarter turn right \c;-90\n; -> radar dirigé à gauche
\c; 90\n; -> radar is facing a quarter turn left \c; 90\n; -> radar dirigé à droite
\t;focus: \c;\l;float\u cbot\float;\n; (default value\c;360\n;) \t;focus: \c;\l;float\u cbot\float;\n; (\c;360\n; par défaut)
Opening angle of the radar, in degrees. Angle d'ouverture du radar, en degrés.
\t;min: \c;\l;float\u cbot\float;\n; (default value \c;0\n;) \t;min: \c;\l;float\u cbot\float;\n; (\c;0\n; par défaut)
Minimum detection distance, in meters. Objects that are closer than the minimum distance will not be detected. Distance minimale de détection, en mètres. Avant cette distance, les objets sont ignorés.
\t;max: \c;\l;float\u cbot\float;\n; (Default value\c;1000\n;) \t;max: \c;\l;float\u cbot\float;\n; (\c;1000\n; par défaut)
Maximum detection distance, in meters. Objects that are farther away than the maximum distance will not be detected. Distance maximale de détection, en mètres. Au delà de cette distance, les objets sont ignorés.
\t;way: \c;\l;float\u cbot\float;\n; (default value\c;1\n;) \t;sens: \c;\l;float\u cbot\float;\n; (\c;1\n; par défaut)
Determines which way the objects are detected. With value \c;1\n;, returns the closest object found in the specified zone. With value \c;-1\n;, the farthest object in the zone will be returned. Sens dans lequel s'effectue la recherche. Avec la valeur \c;1\n;, on cherche de l'intérieur vers l'extérieur. Autrement dit, c'est l'objet le plus proche qui est trouvé. Avec \c;-1\n;, on cherche de l'extérieur vers l'intérieur. On trouvera donc l'objet le plus éloigné.
\t;Return value: \c;\l;object\u cbot\object;\n; \t;Valeur retournée: \c;\l;object\u cbot\object;\n;
Returns the first object found that corresponds to the specified category in the specified zone. If no object was found, returns the value \c;\l;null\u cbot\null;\n;. Objet trouvé le plus proche. La valeur \c;\l;null\u cbot\null;\n; indique que rien n'a été trouvé.
\t;Remark \t;Remarque
You do not have to give all the parameters. Here are two examples of instructions that are equivalent: Il n'est pas nécessaire de donner tous les paramètres. Voici deux exemples identiques:
\c; \c;
\s; radar(Titanium, 0, 360, 0, 1000); \s; radar(Titanium, 0, 360, 0, 1000);
\s; radar(Titanium); // equivalent \s; radar(Titanium); // identique
\s; radar(Titanium, 0, 90, 0, 1000); \s; radar(Titanium, 0, 90, 0, 1000);
\s; radar(Titanium, 0, 90); // equivalent \s; radar(Titanium, 0, 90); // identique
\n; \n;
When one or more parameters are not specified, the default values indicated above are used instead; only the first parameter is compulsory. En fait, lorsque des paramètres manquent, ils prennent les valeurs par défaut indiquées plus haut. Le premier paramètre \c;catégorie\n; est obligatoire. Les cinq paramètres suivants sont facultatifs, et sont remplacés par \c;0\n;, \c;360\n;, \c;0\n;, \c;1000\n; et \c;1\n; s'ils manquent.
Generally, only the first parameter is specified: f. ex. \c;radar (AlienAnt)\n; detects the closest ant, wherever it may be. Ceci est très utile. En effet, \c;radar(XXX)\n; trouve l'objet le plus proche, où qu'il soit.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,20 +1,26 @@
\b;Instruction \c;readln\n; \b;Instruction \c;readln\n;
Read one line from an open file in the files/ folder. This is a method of the \c;\l;file\u cbot\file;\n; class. This is the reason why we always write \c;handle.readln()\n;¦: L'instruction \c;readln();\n; lit une ligne de texte dans un fichier ouvert dans le dossier files/. Cette instruction est une méthode de la classe \c;\l;file\u cbot\file;\n;. C'est la raison pour laquelle on n'écrit jamais \c;readln()\n; tout seul, mais \c;handle.readln()\n;:
\c; \c;
\s; s = handle.readln(); \s; s = handle.readln();
\n; \n;
The file must have been opened for reading (\c;"r"\n;) with the \c;\l;open\u cbot\open;\n; instruction. \c;readln\n; returns the string containing the whole line but without the end of line characters 0x0D (CR) and 0x0A (LF). Le fichier doit être ouvert avec l'instruction \c;\l;open\u cbot\open;\n; et le mode \c;"r"\n; (lecture). L'instruction \c;readln\n; retourne une chaîne de caractères contenant la ligne lue, sans les deux caractères de fin de ligne 0x0D (CR) et 0x0A (LF).
Syntax¦: Syntaxe:
\s;\c;string = handle.readln ( );\n; \s;\c;string readln ( );\n;
Example¦: Exemple:
\c; \c;
\s; string s; \s; string s;
\s; s = handle.readln(); \s; s = readln();
\s; if ( s == "abc" ) \s; if ( s == "abc" )
\s; ... \s; ...
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;writeln\u cbot\writeln;\n; and \c;\l;eof\u cbot\eof;\n;. \c;file \n; = fichier
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;handle\n; = poignée, manipuler
\c;readln\n; = abréviation de "read line", lit une ligne
\c;string\n; = chaîne de caractères
\t;Voir aussi
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;writeln\u cbot\writeln;\n; et \c;\l;eof\u cbot\eof;\n;.
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,18 +1,23 @@
\b;Instruction \c;receive\n; \b;Instruction \c;receive\n;
Syntax: Syntaxe:
\s;\c;receive ( name, power );\n; \s;\c;receive ( name, power );\n;
Retrieves an information from the closest \l;information exchange post\u object\exchange;. Reçoit une information de la \l;borne\u object\exchange; la plus proche.
\t;name: \c;string\n; \t;name: \c;string\n;
Name of the information required from the exchange post. This name is a string: it must be written in quotation marks "¦". Nom de l'information à lire dans la borne. Ce nom est une chaîne de caractères; il doit donc être donné entre guillemets "".
\t;power: \c;float\n; \t;power: \c;float\n;
Power of the receiver, which corresponds to maximal distance between the receiver and the exchange post. If the distance is longer, no information is received. Default value is 10 metres. Puissance du récepteur, qui correspond à la distance maximale jusqu'où peut être la borne. La valeur par défaut est de 10 mètres.
\t;Return value: \c;\l;float\u cbot\float;\n; \t;Valeur retournée: \c;\l;float\u cbot\float;\n;
Value of the retrieved information. If no exchange post is close enough, or if the name of the requested information does not exist in the exchange post, the value \c;nan\n; is returned. Valeur de l'information lue. Si aucune borne d'informations n'est à proximité, ou si le nom de l'information à lire n'existe pas dans la borne, la valeur \c;nan\n; est retournée.
\t;See also \t;Dictionnaire anglais-français
\c;\l;send\u cbot\send;\n;, \c;\l;testinfo\u cbot\testinfo;\n; and \c;\l;deleteinfo\u cbot\delinfo;\n;. \c;receive\n; = recevoir
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;name \n; = nom
\c;power \n; = puissance
\t;Voir aussi
\c;\l;send\u cbot\send;\n;, \c;\l;testinfo\u cbot\testinfo;\n; et \c;\l;deleteinfo\u cbot\delinfo;\n;.
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,14 +1,16 @@
\b;Instruction \c;recycle\n; \b;Instruction \c;recycle\n;
Syntax: Syntaxe:
\s;\c;recycle ( );\n; \s;\c;recycle ( );\n;
Recycles the derelict bot in front of the \l;recycler\u object\botrecy; into a \l;titanium cube\u object\titan;. Récupère l'épave placée devant le \l;robot\u object\botrecy;, qui sera transformée en \l;titanium\u object\titan;.
\t;Return value: \c;\l;int\u cbot\int;\n; \t;Valeur retournée: \c;\l;int\u cbot\int;\n;
Zero if OK, or a value different from zero if an error occurred. Zéro si tout est ok, ou valeur non nulle si une erreur est intervenue.
\c;== 0 \n;the derelict bot has been recycled \c;== 0 \n;épave recyclée
\c;!= 0 \n;error, no derelict bot could be recycled \c;!= 0 \n;recyclage impossible
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;recycle\n; = recycler
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,15 +1,14 @@
\b;Instruction \c;retobject\n; \b;Instruction \c;retobject\n;
Syntax: Syntaxe:
\s;\c;retobject ( number );\n; \s;\c;retobject ( rank );\n;
Returns the object corresponding to the given number. Retourne un objet d'après son rang.
\t;number: \c;\l;int\u cbot\int;\n; \t;rank: \c;\l;int\u cbot\int;\n;
Number of the object, between 0 and n. "n" represents the total number of objects in the scene. Rang de l'objet, compris entre 0 et n. "n" représente ici le nombre total d'objets dans la scène.
\t;Return value: \c;\l;object\u cbot\object;\n; \t;Valeur retournée: \c;\l;object\u cbot\object;\n;
Object corresponding to the number. The return value \c;\l;null\u cbot\null;\n; means that no object corresponds to this number, because the number was too high, and there are not so many objects in the scene. Objet trouvé. La valeur \c;\l;null\u cbot\null;\n; indique que rien n'a été trouvé, par exemple lorsque le rang est trop grand.
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,31 +1,34 @@
\b;Instruction \c;return\n; \b;Instruction \c;return\n;
Returns from a function. Syntax: Syntaxe:
\c; \s;\c;void fonction ( )
\s;void function ( )
\s;{ \s;{
\s; return; \s; return;
\s;} \s;}
\n; \n;
\b;For specialists Cette instruction permet de sortir immédiatement d'une \l;fonction\u cbot\function;.
If the \l;function\u cbot\function; has a return type, the \c;return\n; instruction must be followed by the value to be returned:
\b;Pour spécialistes
Lorsqu'une \l;fonction\u cbot\function; rend un résultat, \c;return\n; doit être suivi de la valeur à retourner:
\c; \c;
\s;float Pi ( ) \s;float Pi ( )
\s;{ \s;{
\s; return 3.1415; \s; return 3.1415;
\s;} \s;}
\s;float Mean (float a, float b) \s;float Moyenne (float a, float b)
\s;{ \s;{
\s; return (a+b)/2; \s; return (a+b)/2;
\s;} \s;}
\s;string Sign (float a) \s;string Signe (float a)
\s;{ \s;{
\s; if ( a > 0 ) return "positive"; \s; if ( a > 0 ) return "positif";
\s; if ( a < 0 ) return "négative"; \s; if ( a < 0 ) return "négatif";
\s; return "null"; \s; return "nul";
\s;} \s;}
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;return\n; = retour
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,18 +1,20 @@
\b;Instruction \c;search\n; \b;Instruction \c;search\n;
Syntax: Syntaxe:
\s;\c;search ( category, position );\n; \s;\c;search ( catégorie, pos );\n;
Detects the object of the given category that is closest to the given position. Cherche l'objet d'une catégorie donnée, le plus proche d'une position donnée.
\t;category: \c;\l;int\u cbot\int;\n; \t;catégorie: \c;\l;int\u cbot\int;\n;
\l;Category\u cbot\category; of the requested object. \l;Catégorie\u cbot\category; d'objet cherché.
\t;position: \c;\l;point\u cbot\point;\n; \t;pos: \c;\l;point\u cbot\point;\n;
\c;search\n; returns the object of the given category that is closest to the position indicated here. Position à partir de laquelle s'effectue la recherche.
\t;Return value: \c;\l;object\u cbot\object;\n; \t;Valeur retournée: \c;\l;object\u cbot\object;\n;
Characteristics of the object that has been found. The value \c;\l;null\u cbot\null;\n; means that no object of this category has been found. Objet trouvé. La valeur \c;\l;null\u cbot\null;\n; indique que rien n'a été trouvé.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;search\n; = chercher
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,19 +1,25 @@
\b;Instruction \c;send\n; \b;Instruction \c;send\n;
Syntax¦: Syntaxe:
\s;\c;send ( name, value, power );\n; \s;\c;send ( name, value, power );\n;
Sends an information to the closest \l;information exchange post\u object\exchange;. Envoie une information dans la \l;borne\u object\exchange; la plus proche.
\t;name: \c;string\n; \t;name: \c;string\n;
Name of the information to be sent to the exchange post. This name is a string: it must be written in quotation marks "¦". Nom de l'information à écrire dans la borne. Ce nom est une chaîne de caractères; il doit donc être donné entre guillemets "".
If there is any information having this name, a new entry is created, as far as the total number of entries does not exceed 10. If there is already an information having this name, value is simply replaced by the new. S'il n'existe aucune information ayant ce nom, une nouvelle entrée est créée, pour autant que le nombre total d'entrées ne dépasse pas 10. S'il existe déjà une information ayant ce nom, la valeur est simplement remplacée par la nouvelle.
\t;value: \c;float\n; \t;value: \c;float\n;
Value of the information to be sent. Valeur de l'information à envoyer.
\t;power: \c;float\n; \t;power: \c;float\n;
Power of the transmitter, which corresponds to the maximal distance to where information can be the sent. Default value is 10 metres. Puissance de l'émetteur, qui correspond à la distance maximale jusqu'où peut être la borne. La valeur par défaut est de 10 mètres.
\t;See also \t;Dictionnaire anglais-français
\c;\l;receive\u cbot\receive;\n;, \c;\l;testinfo\u cbot\testinfo;\n; and \c;\l;deleteinfo\u cbot\delinfo;\n;. \c;receive\n; = recevoir
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;name \n; = nom
\c;value \n; = valeur
\c;power \n; = puissance
\t;Voir aussi
\c;\l;receive\u cbot\receive;\n;, \c;\l;testinfo\u cbot\testinfo;\n; et \c;\l;deleteinfo\u cbot\delinfo;\n;.
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,19 +1,22 @@
\b;Instruction \c;shield\n; \b;Instruction \c;shield\n;
Syntax: Syntaxe:
\s;\c;shield ( oper );\n; \s;\c;shield ( oper, radius );\n;
Déploie ou replie le bouclier du \l;robot\u object\botshld;. Lorsque le bouclier est déployé, il est possible d'avancer. Le bouclier protège de toutes les attaques \l;ennemies\u object\mother; dans un rayon compris entre 10 et 25 mètres.
Activates or deactivates the shield of the \l;ahielder\u object\botshld;. You can of course move the shielder when the shield is active. It protects all objects that are inside the shielded sphere from enemy fire. The radius of the sphere can range between 10 and 25 meters.
\t;oper: \c;\l;float\u cbot\float;\n; \t;oper: \c;\l;float\u cbot\float;\n;
\c;1\n; activates the shield. \c;1\n; déploie le bouclier.
\c;0\n; deactivates the shield \c;0\n; replie le bouclier.
A normal \l;power cell\u object\power; fully charged can maintain the shield active during 20 seconds. When the cell is empty, the shield deactivates. Une \l;pile normale\u object\power; à pleine charge permet de maintenir le bouclier pendant 20 secondes avec le rayon maximal de 25 mètres. Lorsque la pile est plate, le bouclier se replie.
\t;radius: \c;\l;float\u cbot\float;\n; \t;radius: \c;\l;float\u cbot\float;\n;
Radius of the shield, ranging between 10 and 25 meters. Rayon du bouclier, compris entre 10 et 25 mètres.
\t;Return value: \c;\l;void\u cbot\void;\n; \t;Valeur retournée: \c;\l;void\u cbot\void;\n;
None. Aucune.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;shield\n; = bouclier
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,22 +1,25 @@
\b;Instruction \c;sizeof\n; \b;Instruction \c;sizeof\n;
The sizeof function lets you know the number of elements contained in an \l;array\u cbot\array;. L'instruction \c;sizeof(array)\n; permet de connaître le nombre d'éléments contenus dans un \l;tableau\u cbot\array;. En fait, c'est le dernier élément existant plus 1 (les cases "vides" sont comptées).
That is the index of the last element plus one ("empty" elements are counted).
\c; \c;
\s;{ \s;{
\s; int a[12]; \s; int a[12];
\s; a[5] = 345; \s; a[5] = 345;
\s; message( sizeof(a) ); // will display 6 \s; message( sizeof(a) ); // affiche 6
\s;} \s;}
\n; \n;
In this example we have 6 elements in the array after \c;a[5]=345\n;. The non initialized elements \c;[0]\n;, \c;[1]\n;, \c;[2]\n;, \c;[3]\n; and \c;[4]\n; will be counted. Dans cet exemple, il y a 6 éléments dans le tableau après avoir fait \c;a[5]=345\n;. Les éléments non initialisés \c;[0]\n;, \c;[1]\n;, \c;[2]\n;, \c;[3]\n; et \c;[4]\n; sont comptés avec l'élément \c;[5]\n;.
With multidimensionnal arrays you can get the size of a sub array: Avec un tableau à plusieurs dimensions, il est possible d'obtenir n'importe quelle taille:
\c; \c;
\s;float xy[][]; // 2 dimensionnal array \s;float xy[][]; // un tableau à 2 dimensions
\s;xy[5][10] = 67; \s;xy[5][10] = 67;
\s;message( sizeof(xy) ); // will display 6 \s;message( sizeof(xy) ); // affiche 6
\s;message( sizeof(xy[5]) ); // will display 11 \s;message( sizeof(xy[5]) ); // affiche 11
\s; \s;
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;array \n; = tableau
\c;sizeof\n; = taille de
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,17 +1,20 @@
\b;Instruction \c;sniff\n; \b;Instruction \c;sniff\n;
Syntax: Syntaxe:
\s;\c;sniff ( );\n; \s;\c;sniff ( );\n;
Sounds the underground in front of the \l;sniffer\u object\botsr;. According to what raw materials were detected, the following objects will be created: Effectue un sondage du sous-sol devant le \l;robot\u object\botsr;. En fonction du sous-sol, les objets suivants sont créés:
\c;TitaniumSpot\n; -> \l;Red cross\u object\stonspot; \c;TitaniumSpot\n; -> \l;Croix rouge\u object\stonspot;
\c;UraniumSpot \n; -> \l;Yellow circle\u object\uranspot; \c;UraniumSpot \n; -> \l;Rond jaune\u object\uranspot;
\c;PowerSpot \n; -> \l;Green cross\u object\enerspot; \c;PowerSpot \n; -> \l;Croix verte\u object\enerspot;
\t;Return value: \c;\l;int\u cbot\int;\n; \t;Valeur retournée: \c;\l;int\u cbot\int;\n;
Zero if everything is OK, or a value different from zero if an error occurred. Zéro si tout est ok, ou valeur non nulle si une erreur est intervenue.
\c;== 0 \n;sounding performed \c;== 0 \n;sondage effectué
\c;!= 0 \n;sounding impossible \c;!= 0 \n;sondage impossible
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;sniff\n; = renifler
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,23 +1,27 @@
\b;Instruction \c;space\n; \b;Instruction \c;space\n;
Syntax : Syntaxe:
\s;\c;space ( center, rmin, rmax, dist );\n; \s;\c;space ( center, rmin, rmax, dist );\n;
Determines the position of the nearest free space around a given position. Calcule un emplacement libre autour d'un point central.
\t;center: \c;\l;point\u cbot\point;\n; (default: bot position) \t;center: \c;\l;point\u cbot\point;\n; (position du robot par défaut)
Desired position of the free space. Position centrale autour de laquelle la recherche est effectuée.
\t;rmin: \c;\l;float\u cbot\float;\n; (default value: \c;8\n;) \t;rmin: \c;\l;float\u cbot\float;\n; (\c;10\n; par défaut)
Minimum distance from the desired position. Rayon minimal à partir duquel la recherche est effectuée.
\t;rmax: \c;\l;float\u cbot\float;\n; (default value: \c;50\n;) \t;rmax: \c;\l;float\u cbot\float;\n; (\c;50\n; par défaut)
Maximum distance from the desired position. Rayon maximal après lequel la recherche est stoppée.
\t;dist: \c;\l;float\u cbot\float;\n; (default value: \c;4\n;) \t;dist: \c;\l;float\u cbot\float;\n; (\c;4\n; par défaut)
Required distance between two free spaces. Distance requise entre deux emplacements libres.
\t;Return: \c;\l;point\u cbot\point;\n; \t;Valeur retournée: \c;\l;point\u cbot\point;\n;
Position of the free space. Position libre.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;space \n; = espace
\c;center\n; = centre
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,22 +1,22 @@
\b;Instruction \c;static\n; (for specialists) \b;Instruction \c;static\n; (pour spécialistes)
\l;Class\u cbot\class; members declared with \c;static\n; are shared between all instances of the class. Les éléments d'une \l;classe\u cbot\class; précédés du mot \c;static\n; sont partagés en commun avec toutes les instances de cette classe. C'est à dire qu'une valeur écrite par l'une des instances sera lisible par toutes les autres.
\c; \c;
\s;public class MyClass \s;public class MaClass
\s;{ \s;{
\s; static int nb = 1; \s; static int nb = 1;
\s; static string [ ] list = null; \s; static string [ ] liste = null;
\s;} \s;}
\s;void Test () \s;void Test ()
\s;{ \s;{
\s; MyClasse item1(); \s; MaClasse item1();
\s; MyClasse item2(); \s; MaClasse item2();
\s; item1.nb = 3; \s; item1.nb = 3;
\s; item1.list[item1.nb] = "Hello"; \s; item1.liste[item1.nb] = "Hello";
\s; message( item2.list[item2.nb] ); // display "Hello" \s; message( item2.liste[item2.nb] ); // affiche "Hello"
\s;} \s;}
\n; \n;
\c;Static\n; members can be declared \c;\l;private\u cbot\private;\n; so they will be only acessible from within class members (including constructors and destructors). Les éléments \c;static\n; peuvent également être déclarés comme \c;\l;private\u cbot\private;\n;. Dans ce cas, ces éléments ne sont accessibles que dans les méthodes de la classe (constructeur et destructeur inclus).
\t;See also \t;Voir aussi
\c;\l;class\u cbot\class;\n;, \c;\l;synchronized\u cbot\synchro;\n; \c;\l;class\u cbot\class;\n;, \c;\l;synchronized\u cbot\synchro;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,20 +1,24 @@
\b;Instruction \c;strfind\n; \b;Instruction \c;strfind\n;
Find a substring in a string and returns the position of the first substring found or \l;nan\u cbot\nan; if the substring has not been found. Cette instruction cherche une sous-chaîne dans une chaîne et retourne la position du début de la sous-chaîne.
Syntax¦: Syntaxe:
\s;\c;strfind ( string, sub );\n; \s;\c;strfind ( string, sub );\n;
\t;string: \c;\l;string\u cbot\string;\n; \t;string: \c;\l;string\u cbot\string;\n;
String we are searching in. Chaîne dans laquelle on effectue la recherche.
\t;sub: \c;\l;string\u cbot\string;\n; \t;sub: \c;\l;string\u cbot\string;\n;
Substring we are searching for. Sous-chaîne recherchée.
Examples¦: Exemples:
\s;\c; int pos = strfind("abcdef", "ab"); // pos will be 0 \s;\c; int pos = strfind("abcdef", "ab"); // pos vaut 0
\s; int pos = strfind("abcdef", "de"); // pos will be 3 \s; int pos = strfind("abcdef", "de"); // pos vaut 3
\s; int pos = strfind("abcdef", "xy"); // pos will be \l;nan\u cbot\nan; \s; int pos = strfind("abcdef", "xy"); // pos vaut \l;nan\u cbot\nan;
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;string\n; = chaîne de caractères
\c;find \n; = trouve
\t;Voir aussi
\c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n; \c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,33 +1,29 @@
\b;Type \c;string\n; \b;Type \c;string\n;
Use a variable of this type for storing characters or strings. Ce type permet de représenter une chaîne de caractères, qui contiendra quelques caractères, ou toute une phrase. Par exemple:
\s;\c;"bonjour"
\s;"c'est une chaîne"
\s;"x"
\s;"" // chaîne vide
\n;
Pour appondre deux chaînes, on utilise l'opérateur \c;+\n;:
\s;\c;"bonjour" + " " + "Monsieur"
\n;
Donne la chaîne:
\s;\c;"bonjour Monsieur"
\n;
Pour mettre un guillemet ou un slash inversé dans une chaîne, il faut écrire:
\s;\c;"C'est \"très\" important" \n;donne\c; C'est "très" important
\s;"%user%\\ant.txt" \n;donne\c; %user%\ant.txt
\n;
Les instructions suivantes sont utiles pour gérer 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.
For example: \t;Voir aussi
\s;\c; "Hello!" \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.
\s; "This is a string"
\s; "x"
\s; "" // empty string
\n;
You can append two strings with the \c;+\n; operator :
\s;\c; "Good morning," + " " + "Sir"
\n;
Returns the string:
\s;\c; "Good morning, Sir"
\n;
If you want to put a quotation mark (") or a backslash (\) in a string you must write¦:
\s;\c;"This is \"very\" important"
\n;which will result in the string \c; This is "very" important.
\s;\c;"%user%\\ant.txt"
\n;will result in \c;%user%\ant.txt
\n;
Following instructions can be used with strings¦:
\c;\l;strlen\u cbot\strlen; \n;Get string length
\c;\l;strleft\u cbot\strleft; \n;Extract left part
\c;\l;strright\u cbot\strright; \n;Extract right part
\c;\l;strmid\u cbot\strmid; \n;Extract center part
\c;\l;strfind\u cbot\strfind; \n;Find a substring.
\c;\l;strval\u cbot\strval; \n;Convert string to number
\c;\l;strupper\u cbot\strupper; \n;Convert to upper case
\c;\l;strlower\u cbot\strlower; \n;Convert to lower case
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

View File

@ -1,16 +1,21 @@
\b;Instruction \c;strleft\n; \b;Instruction \c;strleft\n;
Extracts the first (that is, leftmost) characters from a string. Cette instruction extrait la partie gauche d'une chaîne de caractères.
Syntax¦: Syntaxe:
\s;\c;strleft ( string, len );\n; \s;\c;strleft ( string, len );\n;
\t;len: \c;\l;int\u cbot\int;\n; \t;len: \c;\l;int\u cbot\int;\n;
Number of characters to be extracted. Nombre de caractères à extraire depuis la gauche.
Examples¦: Exemples:
\s;\c; string s = strleft("abcdef", 2); // s is "ab" \s;\c; string s = strleft("abcdef", 2); // s vaut "ab"
\s; string s = strleft("abc", 10); // s is "abc" \s; string s = strleft("abc", 10); // s vaut "abc"
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;string\n; = chaîne de caractères
\c;left \n; = gauche
\c;length\n; = longueur
\t;Voir aussi
\c;\l;strlen\u cbot\strlen;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n; \c;\l;strlen\u cbot\strlen;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,14 +1,18 @@
\b;Instruction \c;strlen\n; \b;Instruction \c;strlen\n;
Get the length of a string. Cette instruction retourne la longueur d'une chaîne de caractères.
Syntax¦: Syntaxe:
\s;\c;strlen ( string );\n; \s;\c;strlen ( string );\n;
Examples¦: Exemples:
\s;\c; int len = strlen("abc"); // len is 3 \s;\c; int len = strlen("abc"); // len vaut 3
\s; int len = strlen(""); // len is 0 \s; int len = strlen(""); // len vaut 0
\s; if ( strlen(s) == 0 ) // is string empty ? \s; if ( strlen(s) == 0 ) // chaîne s vide ?
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;string\n; = chaîne de caractères
\c;length\n; = longueur
\t;Voir aussi
\c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n; \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,12 +1,16 @@
\b;Instruction \c;strlower\n; \b;Instruction \c;strlower\n;
Convert all characters in a string to lowercase. Cette instruction convertit tous les caractères d'une chaîne en minuscules.
Syntax¦: Syntaxe:
\s;\c;strlower ( string );\n; \s;\c;strlower ( string );\n;
Examples¦: Exemples:
\s;\c; string s = strlower("Abc"); // s is "abc" \s;\c; string s = strlower("Abc"); // s vaut "abc"
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;string\n; = chaîne de caractères
\c;lower \n; = minuscules
\t;Voir aussi
\c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n; \c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,20 +1,25 @@
\b;Instruction \c;strmid\n; \b;Instruction \c;strmid\n;
Extracts a substring of a given length starting at a given position from a string. Cette instruction extrait la partie centrale d'une chaîne de caractères.
Syntax¦: Syntaxe:
\s;\c;strmid ( string, pos, len );\n; \s;\c;strmid ( string, pos, len );\n;
\t;pos: \c;\l;int\u cbot\int;\n; \t;pos: \c;\l;int\u cbot\int;\n;
The index of the first character that is to be included in the extracted substring. Position du premier caractère à extraire depuis la gauche.
\t;len: \c;\l;int\u cbot\int;\n; \t;len: \c;\l;int\u cbot\int;\n;
Number of characters to be extracted. Nombre de caractères à extraire.
Examples¦: Exemples:
\s;\c; string s = strmid("abcdef", 1, 2); // s is "bc" \s;\c; string s = strmid("abcdef", 1, 2); // s vaut "bc"
\s; string s = strmid("abcdef", 4, 5); // s is "ef" \s; string s = strmid("abcdef", 4, 5); // s vaut "ef"
\s; string s = strmid("abcdef", 9, 2); // s is "" \s; string s = strmid("abcdef", 9, 2); // s vaut ""
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;string\n; = chaîne de caractères
\c;middle\n; = milieu
\c;length\n; = longueur
\t;Voir aussi
\c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n; \c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,16 +1,21 @@
\b;Instruction \c;strright\n; \b;Instruction \c;strright\n;
Extracts the last (that is, rightmost) characters from a string. Cette instruction extrait la partie droite d'une chaîne de caractères.
Syntax¦: Syntaxe:
\s;\c;strright ( string, len );\n; \s;\c;strright ( string, len );\n;
\t;len: \c;\l;int\u cbot\int;\n; \t;len: \c;\l;int\u cbot\int;\n;
Number of characters to be extracted. Nombre de caractères à extraire depuis la droite.
Examples¦: Exemples:
\s;\c; string s = strright("abcdef", 2); // s is "ef" \s;\c; string s = strright("abcdef", 2); // s vaut "ef"
\s; string s = strright("abc", 10); // s is "abc" \s; string s = strright("abc", 10); // s vaut "abc"
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;string\n; = chaîne de caractères
\c;right \n; = droite
\c;length\n; = longueur
\t;Voir aussi
\c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n; \c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,12 +1,16 @@
\b;Instruction \c;strupper\n; \b;Instruction \c;strupper\n;
Convert all characters in a string to uppercase. Cette instruction convertit tous les caractères d'une chaîne en majuscules.
Syntax¦: Syntaxe:
\s;\c;strupper ( string );\n; \s;\c;strupper ( string );\n;
Examples¦: Exemples:
\s;\c; string s = strupper("Abc"); // s is "ABC" \s;\c; string s = strupper("Abc"); // s vaut "ABC"
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;string\n; = chaîne de caractères
\c;upper \n; = majuscule
\t;Voir aussi
\c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strlower\u cbot\strlower;\n; \c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strval\u cbot\strval;\n;, \c;\l;strlower\u cbot\strlower;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,19 +1,21 @@
\b;Instruction \c;strval\n; \b;Instruction \c;strval\n;
Convert a string to a number. Don't confuse the string \c;"45"\n; that contains actually the two characters \c;4\n; and \c;5\n; and the number \c;45\n;. Cette instruction convertit une chaîne représentant un nombre en un nombre. Il ne faut pas confondre la chaîne \c;"45"\n; qui contient les deux caractères \c;4\n; et \c;5\n; et le nombre \c;45\n;.
Exemples:
Examples¦: \s;\c; string s = "45"+"12"; // s vaut "4512"
\s;\c; string s = "45"+"12"; // s contains "4512" \s; float n = 45 + 12; // n vaut 67
\s; float n = 45 + 12; // n contains 67
\n; \n;
Syntax¦: Syntaxe:
\s;\c;strval ( string );\n; \s;\c;strval ( string );\n;
\n; \n;
Examples¦: Exemples:
\s;\c; float n = strval("1.23"); // n is 1.23 \s;\c; float n = strval("1.23"); // n vaut 1.23
\s; float n = strval("12abc45"); // n is 12 \s; float n = strval("12abc45"); // n vaut 12
\s; float n = strval("abc"); // n is 0 \s; float n = strval("abc"); // n vaut 0
\s; float n = strval("100")+2; // n is 102 \s; float n = strval("100")+2; // n vaut 102
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;string\n; = chaîne de caractères
\t;Voir aussi
\c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n; \c;\l;strlen\u cbot\strlen;\n;, \c;\l;strleft\u cbot\strleft;\n;, \c;\l;strright\u cbot\strright;\n;, \c;\l;strmid\u cbot\strmid;\n;, \c;\l;strfind\u cbot\strfind;\n;, \c;\l;strupper\u cbot\strupper;\n;, \c;\l;strlower\u cbot\strlower;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,25 +1,23 @@
\b;Instruction \c;synchronized\n; (for specialists) \b;Instruction \c;synchronized\n; (pour spécialistes)
A \l;class\u cbot\class; method can be declared \c;synchronized\n;. This is to make sure that the method is never being executed by more than one bot at the same time. Les méthodes d'une \l;classe\u cbot\class; peuvent être déclarées \c;synchronized\n;. Dans ce cas, on assure que deux exécutions de ces méthodes ne peuvent pas être simultanées. Considérez par exemple, la classe absurde suivante:
The following example illustrates the problem:
\c; \c;
\s;class blocking \s;public class bloquage
\s;{ \s;{
\s; static int nb = 33; \s; static int nb = 33;
\s; synchronized int inc( ) \s; synchronized inc( )
\s; { \s; {
\s; int val = nb; \s; int val = nb;
\s; wait ( 2 ); // wait 2 sec. \s; wait ( 2 ); // pour voir
\s; nb = nb + 1; \s; nb = nb + 1;
\s; return val; \s; return val;
\s; } \s; }
\s;} \s;}
\n; \n;
What happens if two bots execute the \c;inc\n; method at the same time¦? Que se passe-t-il, sans le mot \c;synchronized\n;, si deux robots exécutent la méthode \c;inc\n; à peu prêt en même temps?
Both of them will execute \c;val=nb\n; and wait 2 seconds so both of them will have \c;val=33\n;. With \c;synchronized\n; the first bot starts execution with \c;val=33\n; and then waits 2 seconds and returns. Only once the first bot has returned from the \c;inc\n; method, the second bot will be allowed to enter the \c;inc\n; method and therefore the second bot will always have \c;val=34\n;. Tous les deux vont faire \c;val=nb\n; avant d'attendre 2 secondes, donc les deux auront \c;val=33\n;.
Puis tous les deux vont incrémenter \c;nb\n;, qui va passer à \c;35\n;.
Avec \c;synchronized\n;, le premier des robots va commencer l'exécution avec \c;val=33\n;, et attendre les 2 secondes, alors que le second robot va attendre. Lorsque le premier robot va poursuivre, mettre \c;nb=34\n; et quitter en rendant la valeur \c;33\n;, alors seulement le second robot va pouvoir commencer la fonction avec \c;val=34\n;.
You can have more than one synchronized method in your \l;class\u cbot\class; in order to prevent simultaneous execution across more than one method. In other words: as long as a bot's program is inside a synchronized method, no other bot can enter any synchronized method of the same class. \t;Voir aussi
\t;See also
\c;\l;class\u cbot\class;\n;, \c;\l;static\u cbot\static;\n; \c;\l;class\u cbot\class;\n;, \c;\l;static\u cbot\static;\n;
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,31 +1,31 @@
\b;Semicolon \b;Le point-virgule
Always use a semicolon \c;;\n; after a simple expression. For example: Le point-virgule \c;;\n; termine une expression simple. Par exemple:
\c; \c;
\s; int counter = 0; \s; int compteur = 0;
\n; \n;
However, after a \l;bloc\u cbot\bloc;, never put a semicolon: Il n'est pas nécessaire pour terminer un \l;bloc\u cbot\bloc;:
\c; \c;
\s; { \s; {
\s; float dist; \s; float dist;
\s; dist = distance(p1, p2); \s; dist = distance(p1, p2);
\s; } \n;// no semicolon here!\c; \s; } \n;// pas de ; ici!\c;
\n; \n;
Do not use a semicolon either immediately after the instructions \c;\l;while\u cbot\while;\n;, \c;\l;if\u cbot\if;\n; or \c;\l;for\u cbot\for;\n;: Il ne doit jamais être utilisé après un \c;\l;while\u cbot\while;\n;, un \c;\l;if\u cbot\if;\n; ou un \c;\l;for\u cbot\for;\n;:
\c; \c;
\s; if ( a < b ) \n;// no semicolon here!\c; \s; if ( a < b ) \n;// surtout pas de ; ici\c;
\s; { \s; {
\s; b = 100-a; \s; b = 100-a;
\s; } \s; }
\n; \n;
An instruction is always ended by a semicolon, and not by the end of the line. So you can very well put several instructions on the same line: Une instruction est terminée par le point-virgule, et non par la fin de la ligne. Vous pouvez donc très bien mettre plusieurs instructions sur la même ligne:
\c; \c;
\s; int d=20; \s; int d=20;
\s; move(d); \s; move(d);
\s; turn(90); \s; turn(90);
\n; \n;
Is equivalent to: Est équivalent à:
\c; \c;
\s; int d=20; move(d); turn(90); \s; int d=20; move(d); turn(90);
\n; \n;
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,18 +1,22 @@
\b;Instruction \c;testinfo\n; \b;Instruction \c;testinfo\n;
Syntax¦: Syntaxe:
\s;\c;testinfo ( name, power );\n; \s;\c;testinfo ( name, power );\n;
Tests if an information exists in the closest \l;information exchange post\u object\exchange;. Teste si une information existe dans la \l;borne\u object\exchange; la plus proche.
\t;name: \c;string\n; \t;name: \c;string\n;
Name of the information to be tested in the exchange post. This name is a string: it must be written in quotation marks "¦". Nom de l'information à tester dans la borne. Ce nom est une chaîne de caractères; il doit donc être donné entre guillemets "".
\t;power: \c;float\n; \t;power: \c;float\n;
Power of the transmitter, which corresponds to the maximal distance between the transmitter and the exchange post. If the distance is longer, the function returns \c;false\n;. Default value is 10 metres. Puissance de l'émetteur, qui correspond à la distance maximale jusqu'où peut être la borne. La valeur par défaut est de 10 mètres.
\t;Return: \c;\l;bool\u cbot\bool;\n; \t;Valeur retournée: \c;\l;bool\u cbot\bool;\n;
Return \c;true\n; if the information exists. Return and \c;false\n; if the information does not exist or if the receiver is too far away from the exchange post. Retourne \c;true\n; si l'information et \c;false\n; dans le cas contraire.
\t;See also \t;Dictionnaire anglais-français
\c;\l;receive\u cbot\receive;\n;, \c;\l;send\u cbot\send;\n; and \c;\l;deleteinfo\u cbot\delinfo;\n;. \c;name \n; = nom
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;power\n; = puissance
\t;Voir aussi
\c;\l;receive\u cbot\receive;\n;, \c;\l;send\u cbot\send;\n; et \c;\l;deleteinfo\u cbot\delinfo;\n;.
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,5 +1,5 @@
\b;Instruction \c;this\n; \b;Instruction \c;this\n;
Occasionally, a \l;class\u cbot\class; method needs to know the reference to the instance it is acting upon. For example the instance might want to pass it's own reference to another function. An implicit reference name \c;this\n; is available to methods and \c;this\n; is a reference to the current instance. A l'intérieur d'une méthode d'une \l;classe\u cbot\class;, il est possible d'utiliser le mot \c;this\n; qui est une référence à l'instance courante. La plupart du temps, la référence \c;this\n; est utilisée lorsqu'on désire passer une référence à l'instance courante comme paramètre à une fonction.
\c; \c;
\s;public class MyClass \s;public class MyClass
\s;{ \s;{
@ -21,26 +21,25 @@ Occasionally, a \l;class\u cbot\class; method needs to know the reference to the
\s;{ \s;{
\s; MyClass item(); \s; MyClass item();
\s; item.m_str = "Hello"; \s; item.m_str = "Hello";
\s; item.MyFunction(); // display "Hello" \s; item.MyFunction(); // affiche "Hello"
\s;} \s;}
\n; \n;
You can also put \c;this\n; before a field name in a method but this is not necessary. In the example above in the method \c;MyFunction()\n; following two lines have strictly the same meaning: Il est aussi possible d'écrire \c;this.\n; devant un nom de champ, ce qui est plus explicite mais pas nécessaire. Dans l'exemple ci-dessus, nous pouvons écrire dans la fonction \c;MyFunction()\n;:
\c; \c;
\s; m_int = 2; \s; m_int = 2;
\s; this.m_int = 2; // identical \s; this.m_int = 2; // identique
\n; \n;
In a method of the \c;\l;object\u cbot\object;\n; class, you can also use \c;this.\n; before a fieldname. Dans une fonction de la classe \c;\l;object\u cbot\object;\n;, il est possible d'accéder à la position du robot, à son orientation, etc. En fait, on accède ainsi implicitement à l'instance du robot. Il est aussi possible d'écrire \c;this.\n; devant un nom de champ, ce qui est plus explicite:
\c; \c;
\s;extern void object::Display() \s;extern void object::Display()
\s;{ \s;{
\s; message(orientation); \s; message(orientation);
\s; message(this.orientation); // same thing but \s; message(this.orientation); // plus explicite
\s; // more explicit
\s;} \s;}
\n; \n;
However if a field name is hidden by a parameter declaration or a variable declaration you must use \c;this\n;. In the following example the name \c;value\n; of the parameter is the same as the name of the field \c;value\n; of the \l;class\u cbot\class; \c;MyClass\n;, we must therefore write \c;this.value\n; in order to distinguish the field from the parameter. Il est cependant nécessaire d'utiliser \c;this\n; lorsque le nom d'un champ est caché par une déclaration de variable ou de paramètre. L'exemple suivant montre une \l;classe\u cbot\class; appelée \c;MaClasse\n; avec une méthode \c;Put\n;. Comme le nom \c;value\n; du paramètre est le même que le nom du champ de la classe, il est nécessaire d'utiliser \c;this.value\n; pour utiliser le champ de la classe:
\c; \c;
\s;public class MyClass \s;public class MaClasse
\s;{ \s;{
\s; int value; \s; int value;
\s; void Put( int value ) \s; void Put( int value )
@ -49,6 +48,8 @@ However if a field name is hidden by a parameter declaration or a variable decla
\s; } \s; }
\s;} \s;}
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;\l;class\u cbot\class;\n; \c;this\n; = ce
\l;Programming\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,13 +1,16 @@
\b;Instruction \c;thump\n; \b;Instruction \c;thump\n;
Syntax: Syntaxe:
\s;\c;thump ( );\n; \s;\c;thump ( );\n;
Activates the weapon system of the \l;thumper\u object\bottump;, that turns ants and spiders belly up and makes them completely harmless for a while. Applanit le terrain autour du \l;robot\u object\bottump;.
\t;Return value: \c;\l;int\u cbot\int;\n; \t;Valeur retournée: \c;\l;int\u cbot\int;\n;
Zero if everything is OK, a value different from zero if an error occurred. Zéro si tout est ok, ou valeur non nulle si une erreur est intervenue.
\c;== 0 \n;Thumping performed \c;== 0 \n;terrain applani
\c;!= 0 \n;Operation impossible \c;!= 0 \n;opération impossible
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;thump\n; = marteler
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,14 +1,14 @@
\b;Instruction \c;topo\n; \b;Instruction \c;topo\n;
Syntax: Syntaxe:
\s;\c;topo ( position );\n; \s;\c;topo ( position );\n;
Returns the altitude of the ground at a give position. The altitude zero corresponds to sea level. A negative value indicates that at this position ground is covered with water. Retourne l'élévation d'un point quelconque du terrain. Le niveau zéro correspond toujours au niveau de la mer. Une valeur négative indique donc que le point en question se trouve sous l'eau.
\t;position: \c;\l;point\u cbot\point;\n; \t;pos: \c;\l;point\u cbot\point;\n;
Coordinates of the position whose altitude you want to know. Coordonnée de la position dont on désire connaître l'élévation.
\t;Return value: \c;\l;float\u cbot\float;\n; \t;Valeur retournée: \c;\l;float\u cbot\float;\n;
Altitude of the ground at the given position. Elévation du point donné en entrée.
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,5 +1,8 @@
\b;Type \c;true\n; \b;Type \c;true\n;
This value means that a condition is true; it is one of the two values that a \l;boolean\u cbot\bool; \l;variable\u cbot\var; can take. Cette valeur signifie "vrai" pour une \l;variable\u cbot\var; \l;booléenne\u cbot\bool;.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;true\n; = vrai
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,33 +1,36 @@
\b;Instruction \c;turn\n; \b;Instruction \c;turn\n;
Use the instruction \c;turn();\n; to instruct the bot to perform a rotation on itself of a certain number of degrees. Utilisez l'instruction \c;turn();\n; pour faire tourner le robot d'un certain nombre de degrés sur lui-même.
\b;Basic use \b;Utilisation courante
90 degreed means a quarter turn, 180 degrees means a half turn. A positive angle will perform a counterclockwise rotation, a negative angle means a clockwise rotation. Here are some examples with \c;turn();\n;: 90 degrés signifie un quart de tour, 180 degrés signifie un demi-tour, 360 degrés signifie un tour complet. Voici quelques exemples avec \c;turn();\n;:
\c;turn(90);\n; quarter turn to the left \c;turn(90);\n; quart de tour à gauche
\c;turn(-90);\n; quarter turn to the right (negative angle) \c;turn(-90);\n; quart de tour à droite (angle négatif)
\c;turn(180);\n; half turn \c;turn(180);\n; demi-tour
In order to turn the bot towards an object found with the instruction \c;\l;radar\u cbot\radar;();\n;, you must calculate the rotation angle with the instruction \c;\l;direction\u cbot\direct;()\n;: Pour se tourner vers un objet trouvé avec l'instruction \c;\l;radar\u cbot\radar;();\n;, il faut calculer l'angle de la rotation avec l'instruction \c;\l;direction\u cbot\direct;()\n;:
\c; \c;
\s; item = \l;radar\u cbot\radar;(AlienSpider); \s; chose = \l;radar\u cbot\radar;(AlienSpider);
\s; turn(\l;direction\u cbot\direct;(item.position)); \s; turn(\l;direction\u cbot\direct;(chose.position));
\n; \n;
After these lines, just fire the cannon, and there is one hostile element less. Puis il suffit de faire feu, et il y a un élément hostile en moins.
\b;For specialists \b;Pour spécialistes
Syntax: Syntaxe:
\s;\c;turn ( angle );\n; \s;\c;turn ( angle );\n;
Turns the bot with a given angle, right or left, without moving either forward or backward. Tourne d'un certain angle, à gauche ou à droite, sans avancer ni reculer.
\t;angle: \c;\l;float\u cbot\float;\n; \t;angle: \c;\l;float\u cbot\float;\n;
Angle of the required rotation, in degrees. A positive value turns left, a negative value turns right. \c;turn(180)\n; turns round completely. Angle de la rotation désirée, en degrés. Une valeur positive fait tourner à gauche et une valeur négative à droite. 180 signifie un demi-tour.
\t;Return value: \c;\l;int\u cbot\int;\n; \t;Valeur retournée: \c;\l;int\u cbot\int;\n;
Zero if everything is OK, or a value different from zero if an error occurred. Zéro si tout est ok, ou valeur non nulle si une erreur est intervenue.
\c;== 0 \n;rotation performed \c;== 0 \n;rotation effectuée
\c;!= 0 \n;rotation impossible \c;!= 0 \n;rotation impossible
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;turn\n; = tourner
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,33 +1,35 @@
\b;Variable types \b;Les types des variables
When you define a \l;variable\u cbot\var;, you must give two elements:
1) a name Une \l;variable\u cbot\var; est décrite par trois éléments:
2) a type 1) Un nom.
2) Le type du contenu.
3) Le contenu.
Once you defined a variable, you can use it to put information in it. However, the information that a variable can contain must always be of the correct type: a variable of type \l;float\u cbot\float; can not contain a string, etc. Dans un programme, un nom de type est toujours \type;colorié en vert\norm;. Si un type n'est pas colorié, c'est que son nom est mal orthographié. Il faut par exemple frapper tout le nom en minuscules. Voici les différents types possibles:
In a program, the name of a type is always written on \type;green background\norm;. If the name of a type is not colored, this means that the name is misspelled. Type names are always written with lower case characters. Here is a list of the different types:
\s;\c;\l;int\u cbot\int;\n; \s;\c;\l;int\u cbot\int;\n;
For a whole number (12, -500, etc.). Pour un nombre entier (12, -500, etc.).
\s;\c;\l;float\u cbot\float;\n; \s;\c;\l;float\u cbot\float;\n;
For a real number (12, 3.14, 0.2, -99.98, etc.). Pour un nombre réel (3.14, 0.2, -99.98, etc.).
\s;\c;\l;bool\u cbot\bool;\n; \s;\c;\l;bool\u cbot\bool;\n;
For a boolean variable, that can only take the values \c;true\n; or \c;false\n;. Pour un variable booléenne valant vrai ou faux (true ou false).
\s;\c;\l;string\u cbot\string;\n; \s;\c;\l;string\u cbot\string;\n;
For texts ("Hello!", "No object found", etc.) Pour une chaîne de caractères ("bonjour", "le chat", etc.)
\s;\c;\l;point\u cbot\point;\n; \s;\c;\l;point\u cbot\point;\n;
For the coordinates of a point in space; a variable of this type consists of three parts named x, y and z. Pour une coordonnée dans l'espace x,y,z.
\s;\c;\l;object\u cbot\object;\n; \s;\c;\l;object\u cbot\object;\n;
A variable of this type contains the information about an object (bot, building, enemy, etc.). Pour décrire un objet (robot, bâtiment, etc.).
\s;\c;\l;file\u cbot\file;\n;
Pour décrire un fichier de texte.
\s;\c;\l;void\u cbot\void;\n; \s;\c;\l;void\u cbot\void;\n;
This type is an "empty type", that you use when you do not want to specify a type. Pour indiquer "rien".
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot; et \l;catégories\u cbot\category;.

View File

@ -1,67 +1,74 @@
\b;Variables \b;Les variables
A variable is like a box, where you can put some information. The content of the variable can change during the execution of the program. Une variable est un nom qui repère un emplacement en mémoire, dont on peut faire évoluer la valeur durant l'exécution du programme.
Par exemple, pour compter le nombre d'\l;ennemis\u object\mother; présents, vous pouvez déclarer une variable \c;compteur\n; et l'initialiser à zéro. Chaque fois que vous rencontrez un ennemi, vous ajoutez 1 à la variable \c;compteur\n;. Lorsque vous aurez fini de balayer une zone donnée, la variable contiendra le nombre d'ennemis présents dans cette zone.
For example, you can use a variable to count the number of titanium ore units that the grabber has collected and carried to the converter. First, you must find a name for it: the name should not be too long, but explain by itself what the variable is used for. Let's call it \c;countTit\n;. This variable must contain only whole numbers, so choose the type \c;int\n;. At the beginning of the program, you must declare the variable. Then you put the value \c;0\n; into the variable, and every time you grab a titanium ore, you increase the variable by \c;1\n;. At every moment, the variable contains the number of titanium ore units that the grabber collected. La déclaration de la variable \c;compteur\n; s'écrit avec:
\c;\s; int compteur;\n;
For the declaration of the variable, write the following line: L'initialisation à zéro se fait avec:
\c;\s; int countTit;\n; \c;\s; compteur = 0;\n;
To put \c;0\n; into the variable, write: À chaque ennemi trouvé, vous l'augmentez de 1 avec:
\c;\s; countTit = 0;\n; \c;\s; compteur = compteur+1;\n;
At every titanium ore grabbed, write: Notez bien que le nom \c;compteur\n; n'est qu'un exemple. Vous avez pratiquement toute liberté pour inventer le nom qui vous convient le mieux. Par exemple: \c;dist\n;, \c;direct\n;, \c;p2\n;, \c;a\n;, \c;x\n;, \c;chute_2_pierre\n;, etc.
\c;\s; countTit = countTit + 1\n; Le nom doit commencer par une lettre. Il peut contenir ensuite des lettres ou des chiffres, ainsi que le caractère souligné. De plus, vous ne pouvez pas utiliser les mots-clés réservés du langage, tels que \c;\l;for\u cbot\for;\n;, \c;\l;while\u cbot\while;\n;, \c;\l;break\u cbot\break;\n;, \c;\l;continue\u cbot\continue;\n;, \c;do\n;, etc.
On utilise parfois des noms anglais, parfois des noms français, parfois des abréviations, cela n'a pas d'importance. Ce qu'il faut, c'est que le nom exprime clairement à quoi sert la variable. \c;Bmo45\n;, \c;a\n;, \c;tgbin\n; ne sont pas des très bons exemples, mais c'est à vous de choisir!
You have much freedom in the choice of the name for a variable, you can call them by any name, f. ex.: \c;dist\n;, \c;direct\n;, \c;p2\n;, \c;a\n;, \c;x\n;, \c;nothing_2_shoot_at\n;, etc. L'exemple ci-dessus peut très bien s'écrire:
A variable name must always begin with a letter. It can be followed by any combination of letters, digits or the underscore character \c;_\n;. You can of course not use the keywords of the CBOT language like \c;\l;for\u cbot\for;\n;, \c;\l;while\u cbot\while;\n;, \c;\l;break\u cbot\break;\n;, \c;\l;continue\u cbot\continue;\n;, \c;do\n;, etc. \c;\s; int n;
You should be careful about the choice of the names that you give to variables; writing a program can become very difficult if you forget the names of variables or if you do not remember what they are used for. Elaborate your own system to find variable names, and do not use names like \c;Bmo45\n;, \c;a\n; or \c;tgBinX\n;. \s; n = 0;
\s; \n;...\c;
In the example above, the keyword \c;int\n; indicates that this variable can contain only whole numbers, which is adequate to counting objects. If you want to measure a distance, better use a variable that can contain also real numbers, with a fractional part (like 3.45 or 0.034): in this case, use the type \c;float\n;. \s; n = n+1;
In fact, a variable is made up of three parts:
1) the name
2) the type of the information stored inside
3) the content, i.e. the information itself
\t;the name
You need the name to be able to distinguish the different variables from each other.
\t;the type
The \l;type\u cbot\type; determines what kind of information the variable can contain. According to the type, a variable can contain a whole number, a real number, a string, the coordinates of a point, information about an object, etc.
Here is a list of the most common variable types:
o \c;\l;int\u cbot\int;\n; for a whole number (12, -500, etc.)
o \c;\l;float\u cbot\float;\n; for a real number (3.14, 0.2, -99.98, etc.)
o \c;\l;string\u cbot\string;\n; for a character string ("Hello!", "No object found", etc.)
o \c;\l;point\u cbot\point;\n; for a x,y,z-coordinate in space
o \c;\l;object\u cbot\object;\n; for information about an object (bot, building, etc.)
\t;The content
The content of a variable is an information of the kind specified in the type. It can change during the execution of the program.
Once you declared a variable, it still does not contain any value. Before you can use it, you must put a value inside:
\c;\s; int i, j;
\s; j = 25; // j takes the value 25
\s; j = i; // can not write this, because i has got no content yet.
\n; \n;
You can also declare a variable and put a value inside in the same line, writing: Le mot-clé \c;int\n; indique que la variable contient un nombre entier, ce qui est approprié pour un compteur. Pour mesurer une distance, il sera préférable d'utiliser un nombre réel (fractionnaire), qui s'écrit \c;float\n;.
\c;\s; int countTit = 0; En fait, une variable est décrite par trois éléments:
\n; 1) Son nom.
When you assign a value to a variable with the equals sign \c;=\n;, the value on the right side is copied into the value on the left side. Consider the following example: 2) Le type du contenu.
\c;\s; int i, j; 3) Le contenu.
\s; i = 5+2; // i takes the value 7
\s; j = i+6; // j takes the value of i plus 6, this is 13
\s; i = j; // i takes the value of j, this is 13
\n;
At the end of this example, both variables \c;i\n; and \c;j\n; contain the value \c;13\n;.
The following assignment is not correct, because on the left side of the equals sign \c;=\n;, there can be only a variable name: \t;Le nom
Le nom permet d'accéder au contenu.
\t;Le type
Le \l;type\u cbot\type; détermine ce que contient la variable. En effet, une variable peut contenir un nombre entier, un nombre réel, une chaîne de caractères, une coordonnée d'un point, etc.
Les types les plus courants sont:
o \c;\l;int\u cbot\int;\n; pour un nombre entier (12, -500, etc.)
o \c;\l;float\u cbot\float;\n; pour un nombre réel (3.14, 0.2, -99.98, etc.)
o \c;\l;string\u cbot\string;\n; pour une chaîne de caractères ("bonjour", "le chat", etc.)
o \c;\l;point\u cbot\point;\n; pour une coordonnée dans l'espace x,y,z
o \c;\l;object\u cbot\object;\n; pour décrire un objet (robot, bâtiment, etc.)
\t;Le contenu
Le contenu d'une variable peut être une ou plusieurs valeurs, une chaîne de caractères ou une coordonnée, selon le type.
Lorsqu'une variable est déclarée, elle n'a encore aucune valeur. Avant de l'utiliser, il faut obligatoirement lui assigner une valeur:
\c;\s; int i, j;
\s; j = 25; // j prend la valeur 25
\s; j = i; // impossible, car i est inconnu
\n;
Notez que vous pouvez très bien déclarer une variable et l'initialiser directement avec:
\c;\s; int i=0;
\n;
Ou même:
\c;\s; int i=0, j=12, compteur=100;
\n;
Notez que l'assignation \c;=\n; copie la valeur de l'\l;expression\u cbot\expr; de droite dans la variable de gauche. Soit l'exemple suivant:
\c;\s; int i, j;
\s; i = 5+2; // i prend la valeur 7
\s; j = 6+i; // j prend la valeur de i, c-à-d. 13
\s; i = j; // i prend la valeur de j, c-à-d. 13
\n;
A la fin de cet exemple, les variables \c;i\n; et \c;j\n; contiennent toutes deux la valeur \c;13\n;.
L'assignation suivante est incorrecte, car il ne peut y avoir qu'un nom de variable simple à gauche du signe \c;=\n;:
\c;\s; i+2 = j; // impossible \c;\s; i+2 = j; // impossible
\n; \n;
If you want to exchange the values of two variables, you must use a third variable. Here is an example to exchange the content of two variables \c;a\n; and \c;b\n; : Pour permuter les contenus de deux variables, il faut obligatoirement utiliser une troisième variable temporaire. Voici comment permuter \c;a\n; et \c;b\n;:
\c;\s; int temp; \c;\s; int temp;
\s; temp = a; // temp takes the value of a \s; temp = a; // temp prend la valeur de a
\s; a = b; // the content of b is copied into a \s; a = b; // b est copié dans a
\s; b = temp; // the content of temp is copied into b \s; b = temp; // temp est copié dans a
\n; \n;
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,11 +1,8 @@
\b;Type \c;void\n; \b;Type \c;void\n;
Use this type when you want to declare a function that returns nothing. Ce type particulier signifie qu'il n'y a rien.
Example: \t;Dictionnaire anglais-français
\c;\s;void MyFunction(int a) \c;void\n; = nul
\s;{
\s; ... \t;Voir aussi
\s;} \l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.

View File

@ -1,22 +1,25 @@
\b;Instruction \c;wait\n; \b;Instruction \c;wait\n;
The instruction \c;wait();\n; instructs the bot to wait for some seconds, according to the value written in brackets. L'instruction \c;wait();\n; permet d'attendre un certain laps de temps donné en secondes.
\b;Basic use \b;Utilisation courante
In order to wait until the \l;power cell\u object\power; is recharged on a power station, wait 5 seconds with \c;wait(5);\n;. Pour attendre que le robot se soit rechargé sur une station des recharge, attendez 5 secondes en écrivant \c;wait(5);\n;.
In order to wait until the \l;converter\u object\convert; finished transforming some \l;titanium ore\u object\titanore; in a \l;titanium cube\u object\titan;, wait 15 seconds with \c;wait(15);\n;. Pour attendre que le \l;convertisseur\u object\convert; ait transformé du \l;minerai d'uranium\u object\titanore; en un \l;cube de titanium\u object\titan;, attendez 15 secondes avec \c;wait(15);\n;.
\b;For specialists \b;Pour spécialistes
Syntax: Syntaxe:
\s;\c;wait ( time );\n; \s;\c;wait ( time );\n;
Waits for a moment. Attend un certain temps.
\t;time: \c;\l;float\u cbot\float;\n; \t;time: \c;\l;float\u cbot\float;\n;
Specifies the time that the bot must wait. Durée à attendre, en secondes.
\t;Return value: \c;\l;void\u cbot\void;\n; \t;Valeur retournée: \c;\l;void\u cbot\void;\n;
None. Aucune.
\t;See also \t;Dictionnaire anglais-français
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;wait\n; = attendre
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,36 +1,32 @@
\b;Instruction \c;while\n; \b;Instruction \c;while\n;
The instruction \c;while () {}\n; is used to repeat a set of instructions several times. L'instruction \c;while () {}\n; permet de répéter des instructions plusieurs fois.
\b;Basic use \b;Utilisation courante
The most frequent use of \c;while\n; consists in repeating a set of instructions again and again. In order to achieve this, write \c;while (true) {}\n; and put the instructions to be repeated in braces \c;{}\n;. As an example, here is a program that repeats again and again the following actions: L'utilisation la plus courante de \c;while\n; consiste à répéter des instructions encore et encore, à l'infini. Pour ce faire, on écrit \c;while (true) {}\n; et on met les instructions à répéter entre les accolades \c;{}\n;. Voici comment répéter le fait de chercher une araignée, de se tourner vers elle et de tirer:
o look for a spider,
o turn towards it,
o shoot.
\c; \c;
\s; while (true) \s; while (true)
\s; { \s; {
\s; item = \l;radar\u cbot\radar;(AlienSpider); \s; chose = \l;radar\u cbot\radar;(AlienSpider);
\s; \l;turn\u cbot\turn;(direction(item.position)); \s; \l;turn\u cbot\turn;(direction(chose.position));
\s; \l;fire\u cbot\fire;(1); \s; \l;fire\u cbot\fire;(1);
\s; } \s; }
\n; \n;
Just execute this program once, and it will kill all spiders around it. Il suffit d'exécuter ce programme une seule fois, il tuera toutes les araignées autour de lui.
\b;For specialists \b;Pour spécialistes
Syntax : Syntaxe:
\s;\c;while ( condition ) \s;\c;while ( condition )
\s;{ \s;{
\s; \n;Instructions ...\c; \s; \n;Instructions ...\c;
\s;} \s;}
\n; \n;
This instruction allows you to perform the instructions inside the \l;block\u cbot\bloc; several times. Cette structure de boucle permet d'exécuter plusieurs fois les instructions comprises dans le \l;bloc\u cbot\bloc;.
Attention de ne pas confondre \c;while( ) { }\n; avec \c;\l;do\u cbot\do; { } while( );\n;, qui n'effectue le test qu'après le premier tour de boucle.
Be careful not to confuse the instruction \c;while( ) { }\n; with the instruction \c;\l;do\u cbot\do; { } while( );\n;; the latter tests the condition only after the instructions in the block have been performed a first time.
\t;\c;condition\n; \t;\c;condition\n;
The instructions in the block are performed over and over again, as long as the \l;condition\u cbot\cond; is true. Tant que cette \l;condition\u cbot\cond; est vraie, les instructions dans le bloc sont exécutées.
Here is an example : Voici un exemple d'utilisation:
\s;\c;int i = 0; \s;\c;int i = 0;
\s;while ( i < 10 ) \s;while ( i < 10 )
\s;{ \s;{
@ -39,9 +35,12 @@ Here is an example :
\s;} \s;}
\n; \n;
\t;Attention \t;Attention
Do not put a \l;semicolon\u cbot\term; at the end of the line \c;while ( )\n;. Il ne faut pas mettre un \l;point-virgule\u cbot\term; à la fin de la ligne \c;while ( )\n;.
The instructions \c;\l;break\u cbot\break;\n; and \c;\l;continue\u cbot\continue;\n; can be useful inside a block following the instruction \c;while { }\n;. Les instructions \c;\l;break\u cbot\break;\n; et \c;\l;continue\u cbot\continue;\n; sont utiles à l'intérieur d'un bloc \c;while { }\n;.
\t;See also \t;Dictionnaire anglais-français
\l;Instructions\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;while\n; = tant que
\t;Voir aussi
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,21 +1,27 @@
\b;Instruction \c;writeln\n; \b;Instruction \c;writeln\n;
Write one line of text to an open file in the files/ folder. This is a method of the \c;\l;file\u cbot\file;\n; class. This is the reason why we always write \c;handle.writeln()\n;¦: L'instruction \c;writeln();\n; écrit une ligne de texte dans un fichier ouvert dans le dossier files/. Cette instruction est une méthode de la classe \c;\l;file\u cbot\file;\n;. C'est la raison pour laquelle on n'écrit jamais \c;writeln()\n; tout seul, mais \c;handle.writeln()\n;:
\c; \c;
\s; handle.writeln("abc"); \s; handle.writeln("abc");
\n; \n;
The file must have been opened for writing (\c;"w"\n;) with the \c;\l;open\u cbot\open;\n; instruction. The line will automatically be terminated by the end of line characters 0x0D (CR) and 0x0A (LF). Le fichier doit être ouvert avec l'instruction \c;\l;open\u cbot\open;\n; et le mode \c;"w"\n; (écriture). Dans le fichier, la ligne sera automatiquement terminée par les deux caractères de fin de ligne 0x0D (CR) et 0x0A (LF).
Syntax¦: Syntaxe:
\s;\c;handle.writeln ( string );\n; \s;\c;writeln ( string );\n;
Examples¦: Exemples:
\c; \c;
\s; writeln("Line of text"); \s; writeln("Ligne de texte");
\s; string s1 = "abc"; \s; string s1 = "abc";
\s; string s2 = "def"; \s; string s2 = "def";
\s; writeln(s1 + " " + s2); \s; writeln(s1 + " " + s2);
\n; \n;
\t;See also \t;Dictionnaire anglais-français
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;readln\u cbot\readln;\n; and \c;\l;eof\u cbot\eof;\n;. \c;file \n; = fichier
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \c;handle \n; = poignée, manipuler
\c;writeln\n; = abréviation de "write line", écrit une ligne
\c;string \n; = chaîne de caractères
\t;Voir aussi
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;readln\u cbot\readln;\n; et \c;\l;eof\u cbot\eof;\n;.
\l;Programmation\u cbot;, \l;types\u cbot\type; et \l;catégories\u cbot\category;.

View File

@ -1,45 +1,38 @@
\b;Controls \b;Commandes
You are advised to play with one hand on the arrow keys and the other hand on the mouse. Il est recommandé de jouer avec la main gauche sur les touches flèches du clavier, et la main droite sur la souris.
\t;Bots \t;Robots
\key;\key left;\norm; = turn left \key;\key left;\norm; = tourne à gauche.
\key;\key right;\norm; = turn right \key;\key right;\norm; = tourne à droite.
\key;\key up;\norm; = move forward \key;\key up;\norm; = avance.
\key;\key down;\norm; = move back \key;\key down;\norm; = recule.
These controls are unavailable when working with the \l;practice bots\u object\bottr;. Ces commandes ne sont pas disponibles avec les \l;robots d'entraînement\u object\bottr;.
\key;\key gup;\norm; = take off and climb \button 28; \key;\key gup;\norm; = monte (bouton \button 28;).
\key;\key gdown;\norm; = descend and land \button 29; \key;\key gdown;\norm; = descend (bouton \button 29;).
These controls are of course restricted to the \l;astronaut\u object\human; as well as the various \l;winged bots\u object\botgj; and in selected missions only. Evidemment, ces deux commandes ne sont valables que pour le \l;cosmonaute\u object\human; et les \l;robots volants\u object\botgj;, seulement dans certaines missions.
mouse forward = higher aim \key;\key action;\norm; = action principale selon le robot sélectionné. Par exemple, avec un \l;robot déménageur\u object\botgr;, cette commande actionne le bras. Avec un robot \l;shooter\u object\botfr;, cette commande fait feu (bouton \button 42;).
mouse backward = lower aim
mouse right = aim right
mouse left = aim left
These controls are only available to the \l;shooters\u object\botfr;, the \l;orga shooters\u object\botor; and the \l;phazer shooter\u object\botphaz;.
\key;\key action;\norm; = main action for a given selection (human or bot) \t;Sélections
This control will for example operate the arm of a \l;grabber\u object\botgr; or fire a \l;shooter\u object\botfr; \button 42;. \key;\key next;\norm; = sélectionne l'objet suivant.
\key;\key human;\norm; = sélectionne le cosmonaute.
\key;\key desel;\norm; = sélection précédente (bouton \button 10;).
\t;Selections \t;Caméra
\key;\key next;\norm; = selects next object \key;\key camera;\norm; = passe d'une vue externe à une vue interne (bouton \button 13;).
\key;\key human;\norm; = selects astronaut \key;\key near;\norm; = caméra plus proche (si vue externe).
\key;\key desel;\norm; = previous selection \button 10; \key;\key away;\norm; = caméra plus loin (si vue externe).
\key;\key visit;\norm; = montre le lieu d'un message et met le jeu en pause. Une nouvelle action de cette commande montre le message suivant.
\t;Camera \t;Aide
\key;\key camera;\norm; = shifts between onboard and following cameras \button 13; \key;\key help;\norm; = instructions sur la mission.
\key;\key near;\norm; = zoom in \key;\key prog;\norm; = instructions sur la programmation.
\key;\key away;\norm; = zoom out
\key;\key visit;\norm; = pauses the game and shows where the latest message originated. Press again to show origin of previous message.
\t;Help \t;Jeu
\key;\key help;\norm; = mission instructions \key;\key speed10;\norm; = vitesse normale x1.
\key;\key prog;\norm; = programming help \key;\key speed15;\norm; = vitesse moyenne x1.5.
\key;\key speed20;\norm; = vitesse rapide x2.
\key;\key quit;\norm; = quitte la mission (bouton \button 11;).
\t;Game Toutes ces touches peuvent être redéfinies dans les options/commandes.
\key;\key speed10;\norm; = normal speed x1
\key;\key speed15;\norm; = medium speed x1.5
\key;\key speed20;\norm; = faster speed x2
\key;\key quit;\norm; = exits mission \button 11;
All these commands can be redefined in the options/controls menu.

View File

@ -1,19 +1,24 @@
\b;Exercice \b;Exercice
Several \l;information exchange posts\u object\exchange; are standing along the way. When the bot is close enough to a post, it can read the instructions it contains. The \l;information exchange posts\u object\exchange; along the way contain the direction of the next post and the distance. And you do not know how many exchange posts you must get in touch with before arriving at your goal. Des \l;bornes\u object\exchange; d'informations sont placées le long d'un chemin. Lorsque le \l;robot\u object\bottr; est proche d'une borne, il peut lire les informations qu'elle contient. Ces informations donnent la direction et la distance jusqu'à la borne suivante.
\b;General principle \b;Principe
Always repeat: Répéter toujours:
o Retrieve the direction from the \l;exchange post\u object\exchange;. o Lire la direction dans la \l;borne\u object\exchange;.
o Retrieve the distance from the \l;exchange post\u object\exchange;. o Lire la longueur dans la \l;borne\u object\exchange;.
o If no information could be retrieved, stop the program. o Si rien n'a été lu, stopper.
o Execute the rotation. o Tourner dans la direction obtenue.
o Move forward to the next post. o Avancer de la longueur obtenue.
\b;Useful instructions \b;Instructions utiles
\c;\l;while\u cbot\while;\n; to repeat the instructions \c;\l;while\u cbot\while;\n; pour répéter des instructions
\c;\l;receive\u cbot\receive;\n; to get the information from a post \c;\l;receive\u cbot\receive;\n; pour lire les informations d'une borne
\c;\l;move\u cbot\move;\n; to move the bot \c;\l;move\u cbot\move;\n; pour avancer le robot
\c;\l;turn\u cbot\turn;\n; to turn the bot \c;\l;turn\u cbot\turn;\n; pour tourner le robot
\t;See also \b;Pour tuer le temps
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. N'oubliez pas que, pendant que le robot avance de borne en borne, vous pouvez changer de vue en cliquant sur l'icône \button 13; ou en appuyant sur la barre d'espace. Vous pouvez également sélectionner le \l;cosmonaute\u object\human; et suivre le robot. Mais attention à ne pas le heurter, ce qui le ferait dévier de sa trajectoire!
\key;\key help;\norm; permet de revoir ces instructions en tout temps!
\t;Voir aussi
\l;Programmation\u cbot;.

View File

@ -1,20 +1,23 @@
\b;Exercise \b;Exercice
You must follow the \l;target bot\u object\bottr; with the explosive device, but without touching it, otherwise it will blow up. Every time the target bot stops, you must be close to it (less than 10m). After you managed to stay close to the target bot at 10 successive stops, it will lead you to the finishing pad, and the exercise is over. At every stop, the target bot checks that you are there. If you are not there, you must start over again. Vous devez programmer le \l;robot\u object\bottr; d'entraînement pour suivre la caisse d'explosifs, mais sans la toucher, car elle est très fragile. Chaque fois que la caisse s'arrête 2 secondes, vous devez être à proximité immédiate (moins de 10 mètres). Après 10 arrêts, la caisse s'approche de la plate-forme d'arrivée, pour vous y ammener.
A chaque arrêt, la caisse vérifie que vous êtes bien là. Si ce n'est pas le cas, le compteur est remis à zéro. Vous devez donc réussir 10 fois consécutives!
\b;General principle \b;Principe
Repeat forever: Répéter à l'infini:
o Look for the target bot. o Chercher la caisse.
o Calculate the distance to the bot. o Calculer la distance jusqu'à la caisse.
o if the distance to the target bot is less than 5m, move backward. o Si cette distance est plus petite que 5 mètres, reculer.
o Otherwise, calculate the direction of the target bot, and move towards it. o Sinon, calculer la direction de la caisse et s'y diriger.
\b;Useful instructions \b;Instructions utiles
\c;\l;radar\u cbot\radar;\n; to look for the bot (category \c;\l;TargetBot\u object\bottarg;\n;) \c;\l;radar\u cbot\radar;\n; pour détecter la caisse (catégorie \c;\l;TargetBot\u object\bottarg;\n;)
\c;\l;radar\u cbot\radar;\n; to detect obstacles \c;\l;radar\u cbot\radar;\n; pour détecter un obstacle
\c;\l;distance\u cbot\dist;\n; to calculate a distance \c;\l;distance\u cbot\dist;\n; pour calculer une distance
\c;\l;direction\u cbot\direct;\n; to calculate a direction \c;\l;direction\u cbot\direct;\n; pour calculer une direction
\c;\l;if\u cbot\if;\n; to test a condition \c;\l;if\u cbot\if;\n; pour tester une condition
\c;\l;motor\u cbot\motor;\n; to set the motor speeds \c;\l;motor\u cbot\motor;\n; pour commander les moteurs du robot
\t;See also \key;\key help;\norm; permet de revoir ces instructions en tout temps!
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;.

View File

@ -1,11 +1,11 @@
\b;Exercise \b;Exercice
Destroy all four \l;targets\u object\bottarg; with a program using a \c;for\n; loop. You must move 10m to get from one target to another. Détruire les quatre \l;cibles\u object\bottarg; à l'aide d'un programme utilisant une boucle \c;for\n;. Il faut avancer de 10 mètres pour passer d'une cible à l'autre.
\b;Useful instructions \b;Instructions utiles
\c;\l;for\u cbot\for;\n; loop to repeat the instructions \c;\l;for\u cbot\for;\n; boucle pour répéter des instructions
\c;\l;move\u cbot\move;\n; to move the bot \c;\l;move\u cbot\move;\n; pour avancer le robot
\c;\l;turn\u cbot\turn;\n; to turn the bot \c;\l;turn\u cbot\turn;\n; pour tourner le robot
\c;\l;fire\u cbot\fire;\n; to fire the cannon \c;\l;fire\u cbot\fire;\n; pour faire tirer le robot
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;.

View File

@ -1,15 +1,17 @@
\b;Exercise \b;Exercice
Defend against all enemy attacks Défendez-vous de toutes les attaques ennemies.
\b;General idea \b;Idée
The range of your cannon is about 40m. The category of the enemies is \c;AlienAnt\n;. Turn towards the closest ant, even if it is still more than 40m away. But shoot only when it is closer than 40m, in order not to waste your energy. La portée de votre canon est d'environ 40 mètres. Le type des fourmis est \c;AlienAnt\n;. Orientez votre canon en direction de la fourmi la plus proche, même si la distance dépasse 40 mètres. Mais ne tirez que lorsque la distance est inférieure à 40 mètres, pour ne pas gaspiller de l'énergie.
\b;Useful instructions \b;Instructions utiles
\c;\l;radar\u cbot\radar;\n; to detect your enemies (category \c;\l;AlienAnt\u object\ant;\n;) \c;\l;radar\u cbot\radar;\n; pour détecter un ennemi (catégorie \c;\l;AlienAnt\u object\ant;\n;)
\c;\l;direction\u cbot\direct;\n; to calculate a direction \c;\l;direction\u cbot\direct;\n; pour calculer une direction
\c;\l;distance\u cbot\dist;\n; to calculate a distance \c;\l;distance\u cbot\dist;\n; pour calculer une longueur
\c;\l;fire\u cbot\fire;\n; to fire your cannon \c;\l;fire\u cbot\fire;\n; pour tirer
\c;\l;wait\u cbot\wait;\n; to wait \c;\l;wait\u cbot\wait;\n; pour attendre
\t;See also \key;\key help;\norm; permet de revoir ces instructions en tout temps!
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;.

View File

@ -1,11 +1,13 @@
\b;Exercise \b;Exercice
Program the bot so that it will find its way without hitting the walls of the labyrinth. We suppose that you do not know the configuration of the labyrinth, but there are no bifurcations, and no dead-ends. The labyrinth is made of squares measuring 5m each. Programmez le \l;robot\u object\bottr; pour qu'il avance sans se cogner dans un labyrinthe. On part du principe que le labyrinthe n'est pas connu d'avance, et qu'il n'est constitué que d'un chemin, sans aucune bifurcation ni cul-de-sac. Les cases du labyrinthe sont des carrés mesurant 5 mètres de côté.
\b;Useful instructions \b;Instructions utiles
\c;\l;radar\u cbot\radar;\n; to detect obstacles \c;\l;radar\u cbot\radar;\n; pour détecter un obstacle
\c;\l;if\u cbot\if;\n; to test a condition \c;\l;if\u cbot\if;\n; pour test une condition
\c;\l;move\u cbot\move;\n; to move the bot \c;\l;move\u cbot\move;\n; pour avancer le robot
\c;\l;turn\u cbot\turn;\n; to turn the bot \c;\l;turn\u cbot\turn;\n; pour tourner le robot
\t;See also \key;\key help;\norm; permet de revoir ces instructions en tout temps!
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;.

View File

@ -1,10 +1,12 @@
\b;Exercise \b;Exercice
Program the robot in such a way that it arrives on the finishing pad, after having passed by the three blue crosses. Déplacer le robot d'entraînement sur la plate-forme d'arrivée, en passant par les 4 croix bleues.
The platforms and the crosses are all distant of 20m from each other. Les plates-formes et les indicateurs sont tous distants de 20 mètres.
\b;Useful instructions \b;Instructions utiles
\c;\l;move\u cbot\move;\n; to move the bot \c;\l;move\u cbot\move;\n; pour avancer le robot
\c;\l;turn\u cbot\turn;\n; to turn the bot \c;\l;turn\u cbot\turn;\n; pour tourner le robot
\t;See also \key;\key help;\norm; permet de revoir ces instructions en tout temps!
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;.

View File

@ -1,21 +1,22 @@
\b;Exercice \b;Exercice
\b;Exercise Programmez le \l;robot\u object\bottr; pour qu'il trouve toutes les \l;croix bleues\u object\waypoint; posées au sol. Le trajet à effectuer est composé de deux carrés. Le premier mesure 15 mètres de côté, et le deuxième 25 mètres.
The \l;bot\u object\bottr; must pass over all the \l;blue crosses\u object\waypoint; on the ground. The way that must be covered is made of two squares. The first one measures 15 meters, the second 25 meters.
\image tproc1a 8 8; \image tproc1a 8 8;
\b;General principle \b;Fonction
In order to solve this problem, the most efficient solution consists in creating a \l;function\u cbot\function; that instructs the bot to move on a square shape of a certain size. The main program becomes then very simple:\c; Pour résoudre ce problème, il est intéressant de créer une \l;fonction\u cbot\function; qui déplace le robot le long d'un carré. La fonction principale devient alors très simple:
\c; \c;
\s; extern void object::Function3( ) \s; extern void object::Déplacer( )
\s; { \s; {
\s; Square(15); \s; Carré(15);
\s; Square(25); \s; Carré(25);
\s; } \s; }
\n; \n;
\b;Useful instructions \b;Instructions utiles
\c;\l;for\u cbot\for;\n; loop to repeat some instructions \c;\l;for\u cbot\for;\n; boucle pour répéter des instructions
\c;\l;move\u cbot\move;\n; to move the bot \c;\l;move\u cbot\move;\n; pour avancer le robot
\c;\l;turn\u cbot\turn;\n; to turn the bot \c;\l;turn\u cbot\turn;\n; pour tourner le robot
\t;See also \key;\key help;\norm; permet de revoir ces instructions en tout temps!
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;.

View File

@ -1,14 +1,16 @@
\b;Exercise \b;Exercice
Follow the way in form of a spiral. The bot must move 2 times 25m forward and turn, then move 2 times 20m forward and turn, and so on. Programmez le \l;robot\u object\bottr; pour qu'il suive le chemin en forme de spirale. Il faut avancer deux fois de 25 mètres, puis deux fois de 20 mètres. etc., jusqu'à l'arrêt.
\image tproc2 8 8; \image tproc2 8 8;
\b;Fonction
On constate que le mouvement est composé de "L" imbriqués. Le premier, en bleu foncé, avance deux fois de 25 mètres. Le deuxième, en bleu clair, avance de 5 mètres de moins, etc. On peut donc réaliser une \l;fonction\u cbot\function; qui déplace le robot le long d'un "L" dont on donne la longueur.
\b;Function \b;Instructions utiles
You will have noticed that the way is made of "L"-shaped parts that are fit one into another. The first one (dark blue) measures two times 25 meters. The second one (light blue) measures 5 meters less. Let us start with writing the \l;function\u cbot\function; that will move the bot on a "L"-shaped part whose length will be given as a parameter. \c;\l;for\u cbot\for;\n; pour répéter des instructions
\c;\l;move\u cbot\move;\n; pour avancer le robot
\c;\l;turn\u cbot\turn;\n; pour tourner le robot
\b;Useful instructions \key;\key help;\norm; permet de revoir ces instructions en tout temps!
\c;\l;for\u cbot\for;\n; loop to repeat some instructions
\c;\l;move\u cbot\move;\n; to move the bot
\c;\l;turn\u cbot\turn;\n; to turn the bot
\t;See also \t;Voir aussi
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;. \l;Programmation\u cbot;.

View File

@ -1,14 +1,16 @@
\b;Exercise \b;Exercice
In this exercise, a "crazy bot" places many \l;blue crosses\u object\waypoint; on the ground. Just try to find them all. Le robot <petit poucet> sème des \l;croix bleues\u object\waypoint; sur le sol. A vous de les trouver toutes.
\b;Useful instructions \b;Instructions utiles
\c;\l;radar\u cbot\radar;\n; to detect the blue crosses (category \c;\l;WayPoint\u object\waypoint;\n;) \c;\l;radar\u cbot\radar;\n; pour détecter une croix (catégorie \c;\l;WayPoint\u object\waypoint;\n;)
\c;\l;direction\u cbot\direct;\n; to calculate a direction \c;\l;direction\u cbot\direct;\n; pour calculer une direction
\c;\l;if\u cbot\if;\n; to test a condition \c;\l;if\u cbot\if;\n; pour tester une condition
\c;\l;motor\u cbot\motor;\n; to set the motor speeds \c;\l;motor\u cbot\motor;\n; pour commander les moteurs du robot
\t;Remark \t;Remarque
Do not wait too long, because the crazy bot gets down to work immediately. Fortunately, as long as you are in the program editor, the game will pause. N'attendez pas trop, car le petit poucet se met au travail tout de suite. Heureusement, pendant l'édition d'un programme, le jeu se met en pause, y compris le petit poucet.
\t;See also \key;\key help;\norm; permet de revoir ces instructions en tout temps!
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;.

View File

@ -1,35 +1,37 @@
\b;Exercise \b;Exercice
Convert some \l;titanium ore\u object\titanore; to \l;titanium cubes\u object\titan;, then drop 2 titanium cubes on the pads whose coordinates are: Il faut convertir du \l;minerai de titanium\u object\titanore; en \l;titanium\u object\titan;, puis déposer 2 cubes de titanium sur les plates-formes dont les coordonnées sont:
\c; \c;
x=10, y=-60 x=10, y=-60
x=10, y=-65 x=10, y=-65
\n; \n;
\image derrick 8 8; \image derrick 8 8;
The \l;derrick\u object\derrick; extracts titanium ore from the subsoil; you just have to pick it up. Le \l;derrick\u object\derrick; extrait automatiquement du minerai de titanium, qui ne demande qu'à être ramassé.
\image convert 8 8; \image convert 8 8;
The \l;converter\u object\convert; converts titanium ore to titanium cubes. Just drop the titanium ore on the platform, move backward, and wait until it has been converted. Le \l;convertisseur\u object\convert; transforme le minerai en titanium. Pour cela, il suffit de déposer le minerai, de reculer et d'attendre.
\b;General principle \b;Principe
Repeat two times : Répéter 2 fois:
o Wait until there is some titanium ore. o Attendre tant qu'on ne trouve pas de minerai (\c;\l;TitaniumOre\u object\titanore;\n;).
o Go to the titanium ore. o Aller vers le minerai.
o Pick it up. o Prendre le minerai.
o Go to the converter. o Aller vers le convertisseur (\c;\l;Converter\u object\convert;\n;).
o Drop the titanium ore. o Déposer le minerai.
o Move back 2.5 meters. o Reculer de 4 mètres.
o Wait until there is a titanium cube. o Attendre tant qu'on ne trouve pas de titanium.
o Pick up the titanium cube. o Prendre le titanium (\c;\l;Titanium\u object\titan;\n;).
o Go to the platform. o Aller sur une plate-forme.
o Drop the titanium cube. o Déposer le titanium.
\b;Useful instructions \b;Instructions utiles
\c;\l;for\u cbot\for;\n; to repeat some instructions \c;\l;for\u cbot\for;\n; pour répéter des instructions
\c;\l;do - while\u cbot\do;\n; to repeat some instructions \c;\l;do - while\u cbot\do;\n; pour répéter des instructions
\c;\l;radar\u cbot\radar;\n; to look for different objects \c;\l;radar\u cbot\radar;\n; pour détecter des objets
\c;\l;goto\u cbot\goto;\n; to move the bot \c;\l;goto\u cbot\goto;\n; pour déplacer le robot
\c;\l;grab\u cbot\grab;\n; to grab an object \c;\l;grab\u cbot\grab;\n; pour prendre un objet
\c;\l;drop\u cbot\drop;\n; to drop an object \c;\l;drop\u cbot\drop;\n; pour déposer un objet
\t;See also \key;\key help;\norm; permet de revoir ces instructions en tout temps!
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;.

View File

@ -1,11 +1,13 @@
\b;Exercise \b;Exercice
Move the \l;titanium cube\u object\titan; on the finishing pad. You do not know the position of the titanium, but we can tell you the position of the finishing pad x=10 and y=-60. Déplacez le cube de \l;titanium\u object\titan; sur la plate-forme d'arrivée. On ne connaît pas la position du titanium. En revanche, on sait que la plate-forme est à la position x=10 et y=-60.
\b;Useful instructions \b;Instructions utiles
\c;\l;radar\u cbot\radar;\n; to find the titanium cube (category \c;\l;Titanium\u object\titan;\n;) \c;\l;radar\u cbot\radar;\n; pour détecter le titanium (catégorie \c;\l;Titanium\u object\titan;\n;)
\c;\l;goto\u cbot\goto;\n; to move the bot \c;\l;goto\u cbot\goto;\n; pour déplacer le robot
\c;\l;grab\u cbot\grab;\n; to grab an object \c;\l;grab\u cbot\grab;\n; pour prendre un objet
\c;\l;drop\u cbot\drop;\n; to drop an object \c;\l;drop\u cbot\drop;\n; pour déposer un objet
\t;See also \key;\key help;\norm; permet de revoir ces instructions en tout temps!
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;.

View File

@ -1,26 +1,31 @@
\b;Exercise \b;Exercice
Instruct the bot to find all the \l;blue crosses\u object\waypoint; on the ground, but do not get too close to the \l;mines\u object\mine;. When the bot passes over a cross, it disappears. Here is the general principle: Programmez le \l;robot\u object\bottr; pour qu'il trouve toutes les \l;croix bleues\u object\waypoint; posées au sol, en évitant les \l;mines\u object\mine;. Dès que le robot est sur une croix, elle disparaît. Le principe à utiliser est le suivant:
Repeat forever: Répéter à l'infini:
o Look for a mine o Chercher une mine
o If a mine has been found, calculate the opposite direction o Si une mine est trouvée, calculer la direction opposée
o Look for a cross o Chercher une croix
o If nothing has been found, stop the program o Si rien n'est trouvé, stopper
o Calculate the direction of the cross o Calculer la direction de la croix
o Calculate the mean value of the two directions o Calculer la moyenne des deux directions
o Set the motor speeds in order to head towards the mean direction o Donner une consigne de vitesse aux moteurs pour se diriger dans la direction moyenne
\b;The instruction \c;radar\n; \b;L'instruction \c;radar\n;
In order to detect a mine with the \c;\l;radar\u cbot\radar;\n;, we recommend the following parameters: Pour détecter une mine avec \c;\l;radar\u cbot\radar;\n;, nous vous conseillons d'utiliser les paramètres suivants:
\c;\s; radar(Mine, 0, 180, 0, 5);\n; \c;\s; radar(Mine, 0, 180, 0, 5);\n;
With the opening angle of 180 degrees, mines that are behind the bot will not be found. Mines that are at more than 5 meters are also ignored. La détection s'effectue sur 180 degrés. Si la mine est derrière, elle est donc ignorée.
La distance maximale est de 5 mètres. Si la mine est devant mais plus loin, elle est également ignorée.
In order to find a blue cross, simply write: Pour détecter une croix, utilisez:
\c;\s; radar(WayPoint);\n; \c;\s; radar(WayPoint, 0, 360, 0, 100);\n;
Blue crosses will be found everywhere. La détection s'effectue sur 360 degrés, c'est-à-dire partout. La distance de 100 mètres est nettement plus grande que l'enclos. Toutes les croix sont donc détectées.
In order to calculate a direction, use \c;\l;direction\u cbot\direct;\n;. Pour calculer la direction, utilisez \c;\l;direction\u cbot\direct;\n;.
In order to set the motor speeds, use \c;\l;motor\u cbot\motor;\n;. Pour la commande des moteurs, utilisez \c;\l;motor\u cbot\motor;\n;.
\t;See also A vous de jouer ...
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\key;\key help;\norm; permet de revoir ces instructions en tout temps!
\t;Voir aussi
\l;Programmation\u cbot;.

View File

@ -1,7 +1,9 @@
\b;Exercise \b;Exercice
Instruct your \l;bot\u object\bottr; to find all the \l;blue crosses\u object\waypoint; on the ground, but do not get too close to the \l;mines\u object\mine;. Programmez le \l;robot\u object\bottr; pour qu'il trouve toutes les \l;croix bleues\u object\waypoint; posées au sol, en évitant les \l;mines\u object\mine;.
If a bot gets within less than 2m of the center of a mine (which is the position returned by the radar instruction), il will blow up. However, you must take into account the inertia of the bot. Probably a safety distance of 3 to 3.5m would be more appropriate. On ne peut pas s'approcher à moins de 2 mètres d'une mine. Si vous utilisez cette distance dans l'instruction \c;\l;radar\u cbot\radar;\n;, cela ne fonctionnera pas. En effet, il faut tenir compte de l'inertie du robot. Une distance comprise entre 3 et 3.5 mètres semble appropriée. A vous de faire des essais ...
\t;See also \key;\key help;\norm; permet de revoir ces instructions en tout temps!
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
\t;Voir aussi
\l;Programmation\u cbot;.

View File

@ -1,5 +1,5 @@
\b;Objective \b;Objectif
Here you can play around without any definite objective. You can do whatever you want, explore the region, build a base camp and several bots, run various research programs, kill the insects if you find some, etc. Il s'agit ici d'un jeu libre, sans but défini. Vous pouvez donc faire tout ce que vous voulez, explorer les environs, construire des bâtiments ou des robots, effectuer des recherches, tuer des insectes s'il y en a, etc.
\t;See also \t;Voir aussi
\l;Controls\u command;. \l;Commandes\u command;.

Some files were not shown because too many files have changed in this diff Show More