The puzzle-making robot

Action functions available :

depositAt(?); where ? = 0 (trash can), 1, 2, 3 or 4

Test functions available :

circular() which returns true or false
square() which returns true or false
allBlue() which returns true or false
solidYellow() which returns true or false

Warning !!!

Succeed your code with maximum 5 if, no else allowed.

Window to edit your JavaScript code

Test your script

Résult of the execution of your code

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

The puzzle-making robot

The goal of this exercise is to construct Boolean expressions using AND (&&), OR (||) and / or NOT (!).

You are not to use « else » and since there are just 5 destinations, it should be possible to achieve this with 5 successive « if » statements and AND (&&), OR (||) and / or NOT (!).

Write your code so that the robot puts the pieces in the right places.

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