❓ Chapter 4: Conditions · Level 20 of 30
Level 20: Spiral Path
Goal: A long spiral! Teach the robot a rule: if the path ahead is free, move — if not, turn right. ★★★ = 4 blocks or fewer.
▶ Watch how it works
An if block decides: if the path ahead is free, move forward — else turn right.
Got it? Now solve your puzzle ↓ (a different board — work it out yourself!)
Blocks — tap to add
Your program
💡 Need a hint?
Inside “repeat until star”, add “if path ahead”. Put “move forward” in the first part and “turn right” in the else part.
What you learn here
An if block lets the program decide: do one thing when something is true, and another thing when it is not.
Chapter 4 — Conditions: Teach the robot to decide for itself: keep going until the star, and turn only when the path is blocked.
Blocks in this level
- ⬆️move forwardThe robot moves one square the way it is facing.
- ↪️turn rightThe robot turns to its right on the same square.
- ❓if path aheadIf the square ahead is free, runs the first part; if a rock or the edge is ahead, runs the “else” part.
- 🔂repeat until starKeeps running the blocks inside until the robot is on the star.