❓ Chapter 4: Conditions · Level 24 of 30
Level 24: Smart Robot
Goal: This path turns both ways. Make a rule that tries right, and if that is blocked too, turns to the left. ★★★ = 8 blocks or fewer.
▶ Watch how it works
An if inside an if: blocked ahead? Turn right and check again. Still blocked? Turn back the other way.
Got it? Now solve your puzzle ↓ (a different board — work it out yourself!)
Blocks — tap to add
Your program
💡 Need a hint?
If path ahead: forward. Else: turn right, then another “if path ahead”: forward — else turn left two times.
What you learn here
An if block can sit inside another if block. Smart programs check one thing, then another.
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 leftThe robot turns to its left on the same square.
- ↪️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.