You found the bug. Now fix it. The robot must go right 2. Line 2 says move_left(). Change only that line to move_right(). Keep the lines that work.
move_up()
move_up()
Add a missing line
The robot must go up 2. The code had just one move_up(). Add one more move_up() line. Now it goes up 2.
move_right()
repeat 5:
move_right()
Fix the loop number
The star is 6 squares right. One move_right() comes before the loop. So the loop needs 5 more. 1 + 5 = 6.
repeat 4 times
move right
repeat 3 times
move up
Test it again
This code said repeat 3, and the robot bumped a rock. Change 3 to 4 to reach the gap. Press Run and watch. It reaches the flag, so the bug is gone.
move_up()
move_right()
move_right()
Two bugs
Some code has two bugs. The robot must go up 1, then right 2. The code said down, right, left. Lines 1 and 3 were wrong. Here is the fixed code.
For parents
Goal: Your child learns to fix a bug by changing only the wrong part, then testing the code again.
Ask: which line is wrong? What should it say instead?
After a fix, have your child run the code again to check that the robot reaches the goal.
The labs after the cards hold real bugs. Let your child run the code first and watch where it goes wrong.
Away from the screen: Build a block tower from a drawing with one block wrong on purpose. Your child fixes only that block, then checks it against the drawing.