The cabinet-loader 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 :

motor('action') where 'action' = 'start' or 'stop'
load(); the robot loads a cabinet on the truck
comeBack(); the robot comes back on the loading dock

Test functions available :

truckFull() which returns true or false

Test your script

Window to edit your JavaScript code

The cabinet-loader robot

The goal of this exercise is to correctly use loops.

Write your code so that the robot loads as many cabinets as possible onto each truck that arrives. Note that some trucks can carry more cabinets than others. Whatever size truck arrives, the robot must keep loading it until it is full.

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