Art and algorithms

By Katharine Childs. Posted

This wall drawing by Sol LeWitt, in Spoleto’s Carandente Museum, is an inspirational starting point for children to write algorithms for their own artwork. Image credit: commons.wikimedia.org

Katharine Childs takes inspiration from the artist Sol LeWitt to create algorithmic art in primary computing lessons

At first sight, computing and art are an unlikely combination: computing seems precise, prepared and predictable; art seems creative, expressive, and ambiguous. Sol LeWitt (1928 – 2007) was an American artist who conceptualised that the instructions for creating art were as important as the finished piece. He gave his instructions and diagrams to other people so that they could follow them and create wall paintings.

I have developed primary computing activities based on a particular type of LeWitt’s art. These comprise coloured stripes, and involve children writing their own algorithm to draw a stripy picture. An algorithm is a sequence of instructions or a set of rules to achieve something, in this case, some artwork. Once the algorithms have been written, children will work in pairs. One child can take the role of the artist who reads out their instructions and the other child will be the creator who carries out the directions exactly as they are instructed. It’s worth noting that LeWitt made some of his instructions deliberately ambiguous, whereas in the classroom children will need to be precise with their algorithms so that they can be interpreted by a computer, or a human artist working in a robot-like way. 

Adapting across key stages

This idea works well as an unplugged activity by choosing art materials that can quickly create blocks of colour. For example, painting on large sheets of paper taped to the floor or using chalks on the playground tarmac. Just like LeWitt’s art, the creative space needs to have some boundaries marked, so that children can use positional language to describe where to add the stripes. Horizontal or vertical stripes are the easiest to work with, and the activity can be made simpler by using only two colours, or made more complex by using stripes in a repeating pattern. Children will need to think carefully about when to put the pen (or paint or chalk) down onto the paper and when to pick it up again. 

At Key Stage 2, the activity could also be used to write an algorithm to create art in Scratch, a free online programming environment. It is useful for children to do a small-scale, unplugged version of their design to help them plan their work and give them the structure of their algorithm. Although Scratch contains a paint editor for freehand drawing, the activity works best by programming a sprite to draw the stripes one by one on the stage. This will involve some careful calculations to determine the starting and finishing position of the sprite on each line, and pupils could use variables to store and update the values of these positions. As the sequence of instructions grows, children may notice that they repeatedly go to the starting position, put the pen down, draw the stripe, pick the pen up, then change the coordinates and the pen colour ready for the next line. Spotting this pattern helps to determine where to use a repeat loop in the algorithm.

Common misconceptions

When writing algorithms, pupils often underestimate how precise the instructions need to be so that a computer can understand them. This precision can be misunderstood in two ways: 

  1. Missing out steps. It’s easy to make assumptions about what needs to happen to create a piece of art. In these activities, a common misconception is that children forget to explicitly say when to put the pen (or paintbrush or chalk) down on the paper and when to pick it up. Having someone else carry out their instructions is a good way of spotting these omissions, and can help children to debug their algorithm by finding and fixing errors in it.

  2. Missing out detail. Children often make the steps in their algorithms too ambiguous. Adding in detail such as positional language can help to make algorithms more precise. This might include using vocabulary such as ‘left, right, under, touching’ at Key Stage 1, and Key Stage 2 pupils may be able to incorporate precise measurements. Watching someone else carry out their instructions is a useful way for children to think about how to improve their algorithm by adding precision.

Effective scaffolding

You can support pupils to write precise algorithms by scaffolding this activity with examples. A useful technique is to model how to decompose a task into small steps, including deciding what to do first. Pupils can write the first part of the algorithm, test it on a small-scale, check it for errors, amend what they have done so far, and then write some more. This ‘run-test-fix-add’ cycle is a good habit to develop and can be used as part of a toolbox of techniques to be displayed on tables or on the whiteboard. 

There are many opportunities for ‘gotcha’ moments when writing an algorithm for someone else, so expect to hear comments such as, “I didn’t mean that!”. Modelling how to learn from failure at the start of the activity creates a classroom culture that mistakes aren’t a problem in themselves, as long as you persevere and put them right. Classroom displays often include the final version of a piece of work, but displaying an algorithm including errors side-by-side with the debugged version sends a powerful message that it’s OK to fail and learn.  

Learning from failure is also important when pupils take the role of the creator and follow the algorithm. Some children may need support to understand that their role is to help the artist by working in a robot-like way, rather than adding in steps or detail. 

At the end of this activity, the artwork and their algorithms make a great display. Match algorithm and art together, or jumble them and see if others can do the matching! 

LeWitt style Scratch project.

Find out more

Educator

Free

If you’re a UK-based teacher, volunteer, librarian or something in between, we'll send each issue free to your door.

Digital

Free

Just want to read the free PDF? Get each new issue delivered straight to your inbox. No fuss and no spam.

Buy

From £6

If you are UK-based but not involved in education, you can get hard copies by buying back issues or subscribing via our partner service.