The meal-carryer robot

Résult of the execution of your code

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

Action functions available :

go('where'); where 'where' = 'kitchen' or 'school'
vanMeal('what'); where 'what' = 'load' or 'unload'
vanDoors('what'); where 'what' = 'open' or 'close'

Test functions available :

vanEmpty () which returns true or false
vanFull () which returns true or false
atLeast1MealInKitchen () which returns true or false

Test your script

Window to edit your JavaScript code

The meal-carryer robot

The goal of this exercise is to correctly use nested loops.

You must write your code so that the robot delivers all the meals from the kitchen to the school. The number of meals per day varies, but there is always at least one. The number of meals that will fit in the van is unknown and may vary from one van to another. At the start, the van is empty, the doors are closed, and it is located near the school. This is where it should be located at the end of your program.

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.