\b;Exercice
9 \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 et qui donnent la direction et la distance jusqu'à la borne suivante.

\b;Principe
	Repeat forever:
	o  Lire la direction dans la \l;borne\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  Tourner dans la direction obtenue.
	o  Avancer de la longueur obtenue.

In order to repeat always, use a \c;\l;while\u cbot\while; (true)\n; loop. The instructions between the braces \c;{ }\n; will be repeated over and over, or until a \c;\l;break\u cbot\break;\n; instruction is executed.
\s;\c;	while ( true )
\n;
Il faut définir deux \l;variables\u cbot\var; \c;dir\n; et \c;len\n;:
\s;\c;	float  dir, len;
\n;
Et ensuite leur assigner la direction à prendre et la longueur à avancer:
\s;\c;	dir = receive("Direction");
\s;\c;	len = receive("Length");
\n;
A variable of the \l;type\u cbot\type; \c;\l;float\u cbot\float;\n; can take a special value called \c;\l;nan\u cbot\nan;\n;. This value means that the variable contains no number (Not A Number).
When there is no \l;exchange post\u object\exchange; nearby, either because the bot has reached the goal, or because it took the wrong way, the two variables \c;dir\n; and \c;len\n; contain this value. You can test this with the instruction \c;\l;if\u cbot\if;\n;, and stop the program if necessary with the instruction \c;\l;break\u cbot\break;\n;:
\s;\c;	if ( dir == nan )  break;
\n;
If the information retrieval from the \l;exchange post\u object\exchange; has been performed successfully, execute the rotation:
\s;\c;	turn(dir);
\n;
Puis avancer avec:
\s;\c;	move(len);
\n;
\b;Remarque
En cliquant sur une \l;borne\u object\exchange; pour la sélectionner, vous pouvez voir les paramètres qu'elle contient. Dans cet exercice, chaque borne contient deux informations appelées \c;"Direction"\n; et \c;"Length"\n;.

\t;Voir aussi
\l;Exercice précédent\u texch1; et \l;programmation\u cbot;.
