One ball catcher robot

Action functions available :

throw4Balls(); the robot throws 4 balls in the air
catch1Ball(); the robot catches 1 of the 4 balls that fall
show('?'); where '?' = 'largeBlue', 'largeYellow', 'smallBlue', or 'smallYellow'

Test functions available :

smallBall() which returns true or false
blueBall() which returns true or false

Window to edit your JavaScript code

Test your script

Résult of the execution of your code

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

One ball catcher robot

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

The robot can throw 4 balls in the air, then catch and show one ball. It can also check what kind of ball it is: small or not small, blue or not blue.

The robot must show whether it caught the small blue ball, the small yellow ball, the large blue ball or the large yellow ball.

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