Learning Intention
- I can program a robot to repeatedly move to random positions.
Introduction
How did we make Ohbot move in the last lesson? We made Ohbot move a bit like us by using the pick random operator to make a random wait between movements. This week we are going to program Ohbot to look scared. We are going to program Ohbot to look around randomly.
Teacher Input

Share the code with children and ask them to predict what they think will happen each time the green flag is clicked. Discuss how the code can be changed to make Ohbot move through the full range from 0 to 10. Ask children to predict what the code will do.
Activities
Children copy the code. Challenge them to alter the random ranges to make Ohbot more relaxed or more nervous.

Write a program to make other parts of Ohbot move randomly.
Extension
Experiment with the use of pick random. How many different ways can you use pick random to make Ohbot's eyes move?
Plenary
Look at the code for the three random solutions. A the time is random, B the distance moved is random and C the number of times the eyes move is random.

Questions:
- What do you think each will do?
- What is being changed randomly in each piece of code?

Key Points
- Use the 'pick random' operator to introduce unpredictable behavior in Ohbot's movements.
- Change the range of random numbers to adjust how relaxed or nervous Ohbot appears.
- Randomness can affect time delays, movement distance, and the number of repetitions.
- Predicting code behavior helps understand the effects of randomness in programming.
- Explore different ways to use randomness to make Ohbot appear scared or alert.
Need Help?
If you're stuck on any part of this lesson, check out these resources: