I used the 70th anniversary of D-Day as a starting point for an investigation into binary arithmetic, code breaking, computer error correction, and computer programming.

I began by showing children pictures of soldiers about to land in Normandy, a German Enigma machine, and women operating the Colossus computer in Bletchley Park in WW2. I found out what children knew about D-Day and we watched a short BBC *Newsround* report about the 70th anniversary. We talked about the importance of intelligence, codes and code-breaking in the preparations for the D-Day landings.

We then moved on to how computers store information: everything whether it’s text, pictures, music or video is stored as numbers, specifically binary numbers.

This began our investigation of binary maths, using the ‘Binary Numbers’ activity on p4/5 of the excellent Computer Science Unplugged.

Each pair of children had a set of cards like these:

The children noticed that each card was double the one next to it. I explained that it’s vital to keep the cards in this order, explaining that these represent the columns of numbers in binary numbers. Instead of units, tens, hundreds, in binary we have 1s, 2s, 4s, 8s, 16s. I asked the children to predict what the next columns/cards would be: 32s, 64s, 128s, 256s etc.

I then got them to make different numbers by turning the cards over so that the right numbers of dots were showing, and to write a 1 underneath cards that were facing up, and a 0 under cards that were facing down. Using this we converted decimal numbers 6, 13 and 21 into binary:

15 = 8 + 4 + 2 + 1 = 1111 in binary

We talked about how this isn’t ‘one thousand one hundred and eleven’ as we have left tens, hundreds and thousands behind in decimal numbers. In binary we just read this number as ‘one one one one.’

I then asked the children what the smallest number is we could encode using 5 cards (0), and the largest (31). I then asked if there were any numbers between 0 and 31 we could not encode this way. Children had various ideas: 19, 13. We continued the investigation and established that you can show any number like this. We then talked about why this is important for computers: if you order 19 pencils, or your test score is 13/15, you want the computer to be able to remember any number.

A child then asked how computers store letters. This brought us perfectly to the coded message activity (page 8 of *Computer Science Unplugged*). Children use their binary number cards to read the message Tom is trying to send by turning on lights in the windows of a building where he is trapped.

Each row of lights represents one letter, by showing a binary number which you convert to decimal to find the letter in the key.

This combined what we’d learned about binary numbers with code-breaking skills (linking back to WW2 and the importance of the work at Bletchley Park in winning the war). As soon as children noticed that the first letter was ‘H’ they deduced from the context that the first word was probably ‘help’. Children then noticed the rows where no lights were on, and deduced this probably meant a space, so the 1st word had 4 letters and therefore was even more likely to be ‘help’. We talked about how context, knowledge of likely content of messages (such as weather reports) and spotting patterns were the same skills used by code-breakers in WW2.

Children then made up their own codes for partners to read, using the same system. Here an accusation of ‘cheating’ was used as a starting point for a discussion about espionage and intelligence. The Enigma codes were broken because a machine was stolen, and because sometimes operators were careless, sending the same message more than once, or even sending it unencoded (in ‘plaintext’). If you’re writing a secret message, you had better destroy the original – or better still, don’t write it down at all.

If GCHQ are reading this (and hey, I’d be really disappointed if you’re not), I’ve got some possible recruits for you in about 10 years’ time…

We then consolidated out knowledge of binary arithmetic by playing the checksum card trick (p31 of Computer Science Unplugged). I used the interactive resource I made in Scratch to play this on the big screen. This shows the children how computers spot mistakes and correct them. We then used this as jumping-off point for an introductory lesson on Scratch as a tool for learning computer programming, using the first activity from Code Club (These resources are based on a newer version of Scratch which has some differences from the one we use in school).

One of the children was already familiar with Scratch, so she continued to work on her own project while others worked through the project to make a game. Considering they hadn’t used Scratch before, and we only had a very short introduction (taught by the girl who already knew about it), the children learnt a lot in a very short space of time about designing games, coding and the importance of telling computers exactly what you want them to do, in the right order. They fixed mistakes by debugging their code, using trial and improvement until they were ready to move onto the next step of building the game. In about an hour, most children had written code for a playable game from, ahem, scratch.

Great exercise, thank for sharing

You should check your math however 8+4+1 does not equal 15.

Schoolboy error – most grateful! Now corrected.