← CS Unplugged

CS Unplugged activity

Robot grid 3: sensing with CAN_MOVE

About 30 minutesSolo, then compare with a partnerPencil

Now the robot can look before it moves. CAN_MOVE and REPEAT UNTIL let one program handle many different grids, but they also let a program get stuck, crash, or walk right past the goal. For each program, work out what really happens, not what the programmer hoped would happen.

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.