The driving robot

Action functions available :

drive (); the robot drives straight up to the next Xroads
go('direction'); 'direction' = 'left', 'right' or 'straightAhead'

Test functions available :

detourLeft () which returns true or false
detourRight () which returns true or false

Window to edit your JavaScript code

Test your script

Résult of the execution of your code

Notice: the three executions of your program must be correct without changing your code between them.

The driving robot

The goal of this exercice is to encount nested conditionals and learn how to use them.

The robot is able to drive its vehicle and react to traffic information such as detours.

The driver robot usually goes straight ahead, but if there is a left or right detour at the intersection, it must turn left or right.

To make your task easier, you can « copy/paste » from the list of functions found on the top of this exercise.

Good work.

◊ ◊ ◊

© Rupert Meurice de Dormale 2017

All rights reserved, reproduction in whole or in part of the interface and / or the code forbidden without the written agreement of the author

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

adresse