Learning Objective: to be able to design programs that use iteration.
Right Motor Forward Off Algorithm Efficiency This algorithm isn’t very efficient as it contains repeated sets of instructions. Start Stop Left Motor Forward On Delay 2 Left Motor Forward Off Right Motor Forward On Right Motor Forward Off
Right Motor Forward Off Iteration Iteration allows us to repeat sets of instructions. This algorithm repeats the same set of instructions forever. Start Left Motor Forward On Delay 2 Left Motor Forward Off Right Motor Forward On Right Motor Forward Off
Predict what this program will do: Activity 1 Here is the program for the algorithm given on the previous slide. Predict what this program will do: Prediction: Now write this program and test it on Bobbot.
Activity 2 Complete this design in pseudocode for an algorithm that will make Bobbot go forwards and backwards continually. Start Right Motor Forward On Left Motor Forward On Delay 5
Place a screenshot of your code here: Activity 3 Use the Block Editor to create the program you designed in activity 2 and test it on Bobbot. Place a screenshot of your code here:
This instructions inside this FOR loop will be repeated 10 times. FOR Loops It is also possible to repeat a group of instructions a set number of times. We use a FOR loop to do this. This instructions inside this FOR loop will be repeated 10 times.
Place a screenshot of your program here: Activity 4 Adapt the program you created in activity 3 so that the instructions only repeat 5 times. Place a screenshot of your program here:
Place a screenshot of your program here: Activity 5 Create a program that makes Bobbot move in a zig zag like the pattern shown below: Place a screenshot of your program here:
Extension Create a program that makes Bobbot move in a square using a FOR loop. Place a screenshot of your program here: