← CS Unplugged

CS Unplugged activity

Robot grid 2: loops and procedures

About 30 minutesSolo, then compare with a partnerPencil

Real programs don’t write MOVE_FORWARD () six times in a row. This set adds REPEAT n TIMES and procedures with a parameter, the two shortcuts the AP exam uses most. The trick is the same as before: follow the code one step at a time, and count every time around a loop.

Work each question on paper first. Trace the robot’s moves with your pencil right on the grid, one line of code at a time.

CC BY-NC-SA 4.0.