๐ [ โก๏ธ โช๏ธ ] ร 4
๐ What you need
- the shared phone with your block project from module 4
- a friend to be a human loop
- somewhere to walk in a square
โ Do this
- First with bodies: instead of shouting eight commands for a square, shout 'repeat four times: forward, turn right'. Watch your friend do it.
- On the phone, find the 'repeat' block. Drag your move-and-turn pair inside it. Set it to 4.
- Run it. Same square, half the blocks. Count the blocks you deleted โ that number is what a loop saved you.
- Change 4 to 3 and the turn to 120. Watch a triangle appear. One number, whole new shape.
- Put a 'forever' loop around everything and add a small turn. Watch it spin until you stop it.
- Now try to draw a circle. Big repeat number, tiny turn. Point at the moment it stops looking like a polygon.
๐ก Why it works
Loops are why robots can do the boring jobs. A machine sorting maize does not need a million instructions โ it needs one instruction wrapped in 'do this again'. And a robot's main brain loop, running hundreds of times a second, is exactly this: check the sensors, decide, move, repeat.
๐ฅ Challenge
Draw a five-pointed star using only one repeat block. You will need to work out the turn number by trying โ that is allowed and expected.
๐ New words
loopan instruction to do something again and again
repeatthe block that says how many times
๐
Loop Lord
Tap when you have finished this module.