# Pixel Puzzle Pictures and Computational Thinking

Solve simple colour-by-number and logical thinking puzzles and gain a deeper understanding of image representation and compression.

Pixel puzzles turn the ways images are represented as a series of numbers representing pixels into puzzles. They come in various forms from a simple variant of colour-by-numbers to more complex puzzles based on compression where images are represented by fewer numbers so take up less storage – but can you get them back! Each representation needs its own algorithm to follow to get the image back.

Colour the grids or make them from lego, or even use them as needlepoint/tapestry patterns!

• algorithms
• representation of images
• pixels and raster graphics
• compression algorithms
• run length encoding
• data representation
• logical thinking
• computational thinking

Also for younger children practice and explore:

• numeracy
• counting
• colours
• symmetry

Teach as part of:

• computing
• maths
• art
• history

## Simple Colour-by-number Puzzles

Instructions: Simple Colour-by-number Puzzles

Each square holds a number that tells you the colour to colour in that square. Look up the colours in the key.

Explore different algorithms for colouring them in. For example:

1. Work along the rows colouring each pixel in turn before moving to the next row.
2. Pick a colour then work along the rows, colouring pixels of only that colour. When you get to the end of the grid, pick the next colour and start again. Repeat this until you run out of colours.
3. Pick an uncoloured square and colour it, then colour all pixels around it that are the same number, moving outwards until their are no more adjacent pixels with that number. Then pick a new uncoloured square and repeat until the whole picture is done.

Resources: Colour-by-number Puzzles

Here are Colour by Number Pixel Puzzle Picture sheets and solutions that you can download.

Mini beasts Pictures

Halloween Pictures

Christmas Pictures

## The Romans and Pixel Puzzles

Teach some computing when covering the Romans: mosaics are just pixel pictures. They even realised they could make really detailed (high resolution) images by using small tiles or tesserae. Try our Roman Mosaic Pixel Puzzle or why not make your own Roman mosaic version of a pixel puzzle. Find out more on our Roman Mosaic Computing page including a link to an online mosaic designing site.

## Programming Pixel Puzzles

Pixel puzzles can be turned in to programming puzzles by programming a turtle to paint the picture given the numbers. There are different algorithms for programming it just as humans do them in different ways. The turtle could, for example:

• Run back and forth across the rows colouring each square in turn covering the grid just once OR
• Jump around the grid colouring in the first colour, then jump around the grid colouring in the second colour and so on, …
• The program could use a form of run length encoding  (see below) to save having an instruction in the program for every square.

Can the students come up with different ways, or improve their first version to be a simpler program? Let each come up with a way and then have them share the different ways they did it.

## Symmetrical Colour-by-number Puzzles

In these symmetrical colour by number pictures you are only given the numbers for half the pixels. Use symmetry to work out the rest of the numbers and so the rest of the picture.

This can also be used as an introduction to the idea of compression – if you know something about the properties of a picture you can reconstruct the image despite storing fewer numbers!

Instructions: Symmetrical colour-by-number Puzzles

Some squares have a number that tells you the colour to colour in that square. Look up the colours in the key. Other squares have no number. Work out what colour they are by symmetry.

So, for example with a colour lookup table  1 Blue, 2 Red  a row with numbers (where _ means blank)  1 1 1 1 1 2 2 2 _ _ _ _ _ _ _ _  would mean colour five pixels blue and then by symmetry three pixels red,  then three pixels red and five pixels blue.

Complete them in either of two ways (two algorithms). Either:

1.  Use symmetry to first fill out the rest of the grid of numbers to create a normal colour by number pixel, OR
2. Colour in the numbers given, then copy the colours on to the other side.

Resources: Symmetrical colour-by-number Puzzles

Here are Colour by Number Pixel Puzzle Picture sheets and solutions that you can download.

Mini-beast Pictures

## Colour-by-number Puzzles (2)

The simple colour by number pictures include the numbers on the grid, but what if you want to send a picture to someone else. You just need to record the list of numbers and know the grid size. These puzzles can be combined with activities sending images across the room by e.g. holding up cards one at a time, for the distant person to copy down, for example.

Instructions: Colour-by-number Puzzles

Each line of instructions tells you how to colour the next one or more lines of the picture by giving the number corresponding to the colour of the next pixel.

So, for example with a colour lookup table  1 Blue, 2 Red :  1 1 1 2 2 2 would mean colour three pixels blue and then three pixels red.

Resources: Colour-by-number Puzzles

Here are Colour by Number Pixel Puzzle Picture sheets and solutions that you can download.

African Animal Picture

## Run length Encoding Puzzles

Instructions: Run length Encoding Puzzles

We give these puzzles in two forms, one slightly harder where everything is numbers and the other easier to follow where the colours are given explicitly. Each pair gives the number of pixels to colour and the colour to use. Colour the pixels following the instructions in order.

Computational Thinking Hint

The way data (here of images) is represented affects the amount of storage needed. Raster graphics involves treating an image as a grid. You then store a number to represent the colour at every point (or pixel) in the grid. Run-length encoding cuts how many numbers you need to store by counting the runs of numbers.

Resources: Run length Encoding Puzzles

Here are some Run length Encoding Pixel Puzzle Picture sheets and solutions that you can download. The version without a colour key is easier to follow so suitable for younger students.

Egypt Picture

## Logical Thinking Compressed Pixel Puzzles

Instructions: Logical Thinking Compressed  Pixel Puzzles

The numbers on each row of a Logical Thinking Compressed Pixel Puzzle tell you the number of cells in each group of black cells in the row. So if the numbers next to a row are 2,4,5 it means that row has a block of 2 black cells, a block of 4 black cells and a block of 5, in that order. Each block is separated by one or more white cells. White cells could also come before or after the blocks. Columns are encoded in the same way.

Computational Thinking Hint

To solve the compressed pixel puzzles you have to use logical thinking, alternating between different rows and columns, applying the new information you deduce about one to the other.

Resources: Logical Thinking Compressed Pixel puzzles

Here are some computer science linked Pixel puzzle sheets and solutions that you can download (more to come):

More Puzzles

Lots more computational thinking puzzles including the cs4fn Computational Thinking Puzzle Book Issue 1

## Multiplication Table Pixel Puzzles

These colour by number puzzles explore how patterns can lead to new algorithms while learning your times tables. Find out more on our including a link to an online mosaic designing site.