1. Art Sequence

On this page we start to explore an algorithm that can be used to draw lines and coloured squares in the style of Mondrian. Sequences need order and have to be precise to achieve the required outcome.


The code opposite controls a red square sprite.

Can you work out what will happen each time the Green Flag is clicked?

Write down your prediction


Click on the button below to run the code.

Did it do what you expected it to? Write down any differences.


  1. Which code instructions draw a line?

  2. If you run it again, why is the square a different colour? Write down which instruction achieves this.

  3. If you run it again, why is the shape a different size? Write down the instruction which achieves this.

  4. Each time you run the program, it draws the line in a different direction. Which instruction makes this happen?

  5. Write down the instruction that ensures the shapes are always in a different position.


Make small changes to the program, to adapt what it does.

  1. Change the program so that the line is longer. Write down what you changed.

  2. Change the program so that the squares are bigger. Write down what you changed.

  3. Add an instruction to the program so that it draws another square before drawing the line. Write down what you added and where.

  4. From the Pen menu, add an instruction that changes the line colour each time. Write down what you added and where.


Make your own art following the ideas below.

  1. Draw two lines with a right angle in between before stamping a square.
  2. Draw a line and then draw the square in a separate place.
  3. Use this idea to make up your own picture using lines and “stamping” a shape sprite.