Vacuum cleaner

Vacuum cleaner

Trace a path across a room.

Robot vacuum cleaners move across a room automatically collecting dust and small debris. At a very basic level their navigation traces a straight line path, turning when they detect the end of the room.


Write a program to trace across a virtual room on the turtle canvas. First by moving out of a docking station by 20 pixels, turning right and moving 4 meters (100 pixels). Once the end of the room is reached the robot moves up 20 pixels before turning left and moving across the room 4 meters. It needs to do this 5 times to cover the whole room. It does not need to return to the docking station (although this is a nice extension).

Use this boilerplate code as a starting point:

Success Criteria

Remember to add a comment before a subprogram to explain its purpose.

Complete the subprogram called `vacuum` that:

  1. Draws the path of the vacuum cleaner shown below.

Typical inputs and outputs from the program would be:

Knowledge Organiser

Use these resources as a reference to help you meet the success criteria.

Programming guide:


Check that your program outputs the expected result and has met the success criteria.

Check that you have:

  • Used comments within the code to describe the purpose of subprograms and iterations.
Craig'n'Dave logo

Craig ‘n’ Dave

Bett Awards 2024 Finalist