The suitcase-carrying robot

Résult of the execution of your code

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

Action functions available :

go('destination'); where 'destination' = 'runway', 'terminal' or 'box'
suitcase('action'); where 'action' = 'take' or 'deposit'

Test functions available :

luggageOnRunway() which returns true or false

Test your script

Window to edit your JavaScript code

The suitcase-carrying robot

The goal of this exercise is to correctly use loops.

You must write your code so that the robot brings all the luggage into the airport terminal. Note that sometimes there are no suitcases on board the plane. But regardless of how many suitcases have been transported, the robot must bring them all inside.

After work, the robot must return to its storage box.

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.