# Copyright (C) 2019 Free Software Foundation, Inc. # This file is distributed under the same license as the PACKAGE package. # BCE <.>, 2019. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: DATE\n" "PO-Revision-Date: 2019-06-15 18:29+0200\n" "Last-Translator: BCE <.>\n" "Language-Team: French <>\n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Lokalize 18.12.3\n" #. type: Title-text #: ../scene.txt:1 #, no-wrap msgid "A function" msgstr "Une fonction" #. type: Resume-text #: ../scene.txt:2 #, no-wrap msgid "Create a function in order to make your program shorter." msgstr "Créer une fonction pour déplacer un robot." #. type: ScriptName-text #: ../scene.txt:3 #, no-wrap msgid "Move" msgstr "Déplace" #. type: \b; header #: ../help/help.E.txt:1 #, no-wrap msgid "Exercise" msgstr "Exercice" #. type: Plain text #: ../help/help.E.txt:2 #, no-wrap msgid "The bot must pass over all the blue crosses on the ground. The way that must be covered is made of two squares. The first one measures 15 meters, the second 25 meters." msgstr "Programmez le robot pour qu'il trouve toutes les croix bleues 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." #. type: Image filename #: ../help/help.E.txt:4 #, no-wrap msgid "tproc1a" msgstr "tproc1a" #. type: \b; header #: ../help/help.E.txt:5 #, no-wrap msgid "General principle" msgstr "Idée générale" #. type: Plain text #: ../help/help.E.txt:6 #, no-wrap msgid "In order to solve this problem, the most efficient solution consists in creating a function that instructs the bot to move on a square shape of a certain size. The main program becomes then very simple:" msgstr "Pour résoudre ce problème, il est intéressant de créer une fonction qui déplace le robot le long d'un carré. La fonction principale devient alors très simple:" #. type: Source code #: ../help/help.E.txt:7 #, no-wrap msgid "" "extern void object::Function1( )\n" "{\n" "\tSquare(15);\n" "\tSquare(25);\n" "}" msgstr "" "extern void object::Déplacer( )\n" "{\n" "\tCarré(15);\n" "\tCarré(25);\n" "}" #. type: Plain text #: ../help/help.E.txt:13 #, no-wrap msgid "You still have to define the function called Square. In order to do this, you will have to write some instructions outside the block that until now was the frame of each one of your programs. At the very end of the program, after the last closing brace, we will define the function Square. The program will take the following shape:" msgstr "Évidemment, à ce stade, la fonction Carré n'existe pas encore. Pour la créer, vous devrez écrire des instructions hors du bloc, tout à la fin du programme. La structure du programme devient:" #. type: Source code #: ../help/help.E.txt:15 #, no-wrap msgid "" "extern void object::Function1( )\n" "{\n" "\tmain function ...\n" "}\n" "\n" "void object::Square(float length)\n" "{\n" "\tnew function ...\n" "}" msgstr "" "extern void object::Déplacer( )\n" "{\n" "\tfonction principale ...\n" "}\n" "\n" "void object::Carré(float length)\n" "{\n" "\tnouvelle fonction ...\n" "}" #. type: Plain text #: ../help/help.E.txt:25 #, no-wrap msgid "Let us look in detail at the different elements of the declaration of the function Square:" msgstr "Examinons en détail la déclaration de cette fonction Carré:" #. type: Plain text #: ../help/help.E.txt:27 #, no-wrap msgid "" "void\n" "This means that this function will return no value." msgstr "" "void\n" "Ceci indique que la fonction ne retourne aucune valeur." #. type: Plain text #: ../help/help.E.txt:30 #, no-wrap msgid "" "object::\n" "When you write this in front of the function name, you can have access in the function to all the characteristics of the bot, such as position, orientation, etc. In this exercise, this element is not compulsory, as we will not need the characteristics of the bot in the function." msgstr "" "object::\n" "Permet d'accéder aux caractéristiques du robot, telles que pos, angle, etc. Dans cet exercice, cette déclaration est facultative, car on n'accède pas à ces variables." #. type: Plain text #: ../help/help.E.txt:33 #, no-wrap msgid "" "Square ( )\n" "This is the name of the function. You can call it Square, or any other name." msgstr "" "Carré ( )\n" "Nom de la fonction. Vous pouvez choisir le nom qui vous plaît le mieux." #. type: Plain text #: ../help/help.E.txt:36 #, no-wrap msgid "" "float length\n" "Here you define the parameters that the function will get when it is called. The first time the function is actually called with Square(15), the variable length will contain the value 15. The second time, length will contain 25." msgstr "" "float length\n" "Paramètre que reçoit la fonction. A l'intérieur de la fonction, length prendra une première fois la valeur 15 et une deuxième fois la valeur 25." #. type: Plain text #: ../help/help.E.txt:39 #, no-wrap msgid "Here is in detail what will happen when the program is executed:" msgstr "Le flux du programme se déroule ainsi:" #. type: Bullet: '-' #: ../help/help.E.txt:40 #, no-wrap msgid "First the main function Function will be executed." msgstr "On exécute la fonction principale Déplace depuis le début." #. type: Bullet: '-' #: ../help/help.E.txt:41 #, no-wrap msgid "At the line Square(15), the program will follow the red arrow and enter the function Square a first time, length containing 15." msgstr "Lorsqu'on rencontre Carré(15), on suit la flèche rouge pour entrer une première fois dans la fonction Carré." #. type: Bullet: '-' #: ../help/help.E.txt:42 #, no-wrap msgid "At the end of the function Square, the program follows the orange arrow and comes back to the main function." msgstr "Lorsque la fonction Carré est terminée, on revient dans Déplace selon la flèche orange." #. type: Bullet: '-' #: ../help/help.E.txt:43 #, no-wrap msgid "At the line Square(25), the program will follow the blue arrow and enter the function Square a second time." msgstr "On continue Déplace, qui contient alors Carré(25). On suit donc la flèche bleue pour entrer une deuxième fois dans Carré." #. type: Bullet: '-' #: ../help/help.E.txt:44 #, no-wrap msgid "At the end of the function Square, the program follows the light blue arrow and comes back to the main function." msgstr "Lorsque Carré est terminé, on revient dans Déplace en suivant la flèche bleu clair." #. type: Image filename #: ../help/help.E.txt:46 #, no-wrap msgid "tproc1b" msgstr "tproc1b" #. type: Plain text #: ../help/help.E.txt:47 #, no-wrap msgid "In the function Square, use the instructions move and turn. In order to make it shorter, you can use a for loop, that will repeat the instructions move and turn 4 times; however, this is not compulsory." msgstr "L'intérieur de la fonction Carré utilise les instructions move et turn. L'utilisation d'une boucle for répétée 4 fois allège l'écriture, mais n'est pas indispensable." #. type: Source code #: ../help/help.E.txt:49 #, no-wrap msgid "" "void object::Square(float length)\n" "{\n" "\tfor ( int i=0 ; i<4 ; i=i+1 )\n" "\t{\n" "\t\tmove(length);\n" "\t\tturn(90);\n" "\t}\n" "}" msgstr "" "void object::Carré(float length)\n" "{\n" "\tfor ( int i=0 ; i<4 ; i=i+1 )\n" "\t{\n" "\t\tmove(length);\n" "\t\tturn(90);\n" "\t}\n" "}" #. type: \t; header #: ../help/help.E.txt:58 #, no-wrap msgid "See also" msgstr "Voir aussi" #. type: Plain text #: ../help/help.E.txt:59 #, no-wrap msgid "Programming, types and categories." msgstr "Exercice précédent, programmation, types et catégories."