Learn some computer science from building simple things from lego
Our series of blogs on what to do with all that lego scattered over the floor: learn some computer science… from different representations of data to making computational machines and machine learning to algorithms and cellular automata (to come).
Part 1: Lego Computer Science – Pixel Pictures
Digital images come in two types: raster (or bitmap) images and vector images. They are different kinds of image representation. Lego is good for experimenting with the former through pixel puzzles and pixel art…. (read on)
Part 2: Lego Computer Science – compression algorithms
Images are stored as pixels: the equivalent of square or round lego blocks of different colours laid out in a grid like a mosaic. Give each colour a number and draw out a gird of numbers we get a map to recreate the picture from. Turn that grid of numbers into a list and we can store the image as a file of numbers, and send it to someone else to recreate…. (read on)
Part 3: Lego Computer Science – representing numbers
What do we mean by a number and a representation of a number? Are they just the symbols we write? But those symbols 0, 1, 2, … are just that. They are symbols representing numbers not the numbers themselves. They are arbitrary choices. Different cultures past and present use different symbols to mean the same thing… (read on)
Part 4: Lego Computer Science – representing numbers using position
Human societies have represented numbers in lots of ways and there are many ways we could represent numbers even just using lego. Computers store numbers using a different representation again called binary. Before we get to that though we need to understand how we represent bigger numbers ourselves and why it is so useful… (read on)
Part 5: Lego Computer Science – Gray code
Modern computers use a binary representation for numbers. The reason is that they are based on a technology of electrical signals that are either there or not, switches that are on or off. Those two choices are used as two symbols to represent data. It is as though all data will be built of two lego coloured blocks: red and blue, say. How might that then be done? There are still lots of ways that could be chosen. One called Gray code was useful for electronic circuits… (read on)
Part 6: Lego Computer Science – binary
So what is binary? It is just a particular pattern of 1s and 0s or of a pair of colours of lego bricks. It’s not any pattern though. It works just like our decimal system, but with only two symbols instead of ten… (read on)
Part 7: Lego Computer Science – What is computation (simple cellular automata)?
Computation is just applying rules to symbols that replace them with new symbols over and over. If the symbols are a row of lego blocks then the rules say how to replace the lego brick in each position by a new one… (read on)
Part 8: Lego Computer Science – Truth tables?
Truth tables are a simple way to define what we mean by logical connectives like AND, OR and NOT. Build them from Lego…. (read on)
Part 9: Lego Computer Science – Logic with Truth tables

Prove logical facts, like what double negation means, just by mechanically following truth table rules to create new lego proof truth tables. Get all blue (so a tautology) and you have proved a theorem (read on)
More to come…
This page was funded by UKRI, through grant EP/K040251/2 held by Professor Ursula Martin and forms part of a broader project on the development and impact of computing, as well as grant EP/W033615/1.


