How-To Guide
SCRATCH CODING KIT
Random numbers and Coding
Random Movements of the Lizard Robot
Does the lizard robot move well? We just used keyboard arrow keys to control the robot. This time, we will code
the robot to move for a random amount of time. Let’s review first.
Click the ‘Motor’s rotating direction’ block to move the robot forward and click the ‘Stop Motor’ block to turn off
the robot.
How much did they move?
The time you took between activating the motor and stopping the motor was random. Now, we will learn how
to code a motor to activate for a random amount of time.
Refer to the picture below to set an exact time for the motor to activate.
The robot will move forward for 1 second and stop if you activate the program. Let’s set it to move
forward for a random amount of time.