First steps
  Moving the robot
  Tests and logical conditions
How to write, initialize and run a program

Launch RobotProg : you see two windows : the program window where you are going to draw the programme flowchart and a palette containing tools to draw the flowchart.

* Write the flowchart.
To build the flowchart below :
- for each flowchart block : take the block in the palette and click inside program window to place the block there.
- to link the blocks together, choose link tool, click on a block exit, move the mouse towards the following block entry. The link will automatically be created when the mouse pointer arrives at the block entry.


A flowchart must contain one begin block and only one to show where the program begins, and one or more end blocks

* Robot ground display : Choose Window > Execution window menu.
The ground is diplayed in another window with buttons on top to control execution

* Program initialization : click INIT button or choose Execution > Initailization menu.
The program is verified : if it contains no error, you may set the initial robot position and direction by clicking a ground tile or the robot ; the INIT button shows the image of the robot to be initialized.
If the program contains an error, you may not run it, you must first correct the error.

* Run the program : click the Run button or choose Execution > Run menu.

Moving the robot

There are three commands to move the robot : MoveForward, Turn right and Turn left
Those commands appear in rectangular blocks, available in tools palette.
* The Move forward command makes the robot move to the next tile ahead. But be carefull : if the robot is facing a wall when it receives the command, it will crash on the wall, this is an execution error and the programs stops.
* The Turn right and Turn left commands make the robot rotate by 90 ° on its right or on its left. It stays on the same tile.

- Close previous program window and choose File > New program menu.
- Write a program to have the robot make a U-Turn. Run the program.
Remarks :
- a U-Turn is simply turning right (or left) twice.
- in the program window, you can select the U-Turn purpose. At the end of execution, RobotProg will check if the purpose is reached.

Tests and logical conditions
  - Close previous program window and choose File > New program menu.
Now, you are going to write a program to go near a wall.
- Choose Go in front of a wall purpose.

* Programming a test :
- Draw and run the following flowchart :

To change the text inside a test block, choose select tool and double click the block.


The logical condition inside a test block is evaluated when the block is executed. The result is either true or false . If the result is true, the execution continues at the block following the Y exit (Y is for Yes or true) ; if the result is false, the execution continues at the block following the N exit (N is for No or false )
In this example the logical condition is WallAhead, it is a keyword returning a logical result (true or false) in respect with the robot position at the moment the condition is evaluated. If the robot is facing a wall, the program ends, else the robot moves and the test is again executed.


* Step by step execution and current state display .
When a program is executing, you can click Pause button to Pause the execution, and make next instruction be executed by clicking Next step button. You may also click Show variables button to display the current state. A window is displayed, showing various keywords with their values
The complete list of keywords is available with the Help > Robot language summary menu.


* Logical conditions
A logical expression is an expression giving true or false as result. It is possible to combine various keywords with logical operators like And, Or, No. Example : WallAhead And WallOnLeft
You can find a detailed description in the documentation : see chapter Robot language, predefined functions

In this exercise, you are going to reach the purpose "Go to a corner"
The method to achieve that purpose can be the following one : first the robot goes in front of a wall, then it moves along the wall, until it reaches a wall ahead.
To test if the robot has reached a corner, you can use the logical condition WallAhead And ( WallOnLeft Or WallOnRight )