Virtual robotics: the driver robot → Edition

Dashboard

SHOE

Elementary instructions

Drive to the crossroads
Look at the signs
Go left
Go right
Go straight on

Checks

Left deviation?
Right deviation?

Control structures

IF
THEN
ELSE
END IF



Virtual robotics: the driver robot → Execution

Dashboard

Running the program

Step-by-step execution

Test conditions

Initial test conditions...

Test result

Test result...


The driving robot: statement

You have to create a program that will allow the driving robot to continue its route correctly.

When it arrives at a crossroads, the robot driver should normally go straight ahead, but there may be a diversion due to roadworks. The robot driver then has to follow this deviation to reach its destination.

To code your program, you have a number of commands at your disposal that the robot understands:

Your program (code) must be created by dragging the various elements from the "shoe" on the right to the magnetic board on the left. The few basic rules for arranging the various elements (syntax rules) are explained in the "Help" section.

The code you create will be considered correct if the 3 runtime tests are successful (the corresponding buttons have all turned green at the same time).

Tip: if you want to insert a line in your code, just click on the number of the line you want to free on the magnetic board.

Good work and good success.

Never forget that mistakes are more instructive than successes,
as long as you take the trouble to understand the causes.

◊ ◊ ◊

The driver robot: help

Building your program code

All you have to do is drag the various elements provided in the "shoe" and arrange them in the right order on the magnetic board on the left of the screen.

You can always move the elements in this way if you want to change your code.

There is no set order for composing your code; you can start at the end but, in the end, your program will have to comply with the layout rules (syntax rules) defined below.

Syntax rules

By convention, the following elements must stand alone on their lines of code:
- Basic action instructions;
- The "ELSE";
- The "END IF";
- The "REPEAT" (later);
- And the "END WHILE" (later).

Condition structure

To check which side of the coin is visible when it is caught, you can construct a condition as follows.
For line 1, if the face-up side is "Tail", the result will be "True". If the face-up side is "Head", the result will be "False". For line 2 (later), it's the other way round.
Note that the "IF", the Check and the "THEN" have to be in the same line.

Tricks and tips

Before After clicking on number 2
Clicking on a line number in the magnetic board will free up that line so that a code element can be inserted.

To remove an item from the magnetic panel, simply place it on the bin and it will disappear the next time you click on the "Organize" button.

◊ ◊ ◊

© Rupert Meurice de Dormale 2023 (update of the 1995 version)

All rights reserved. Copying in whole or in part prohibited without written permission of the author.

The drawings of the robots are by Jean-Baptiste Sonnet.

adresse