# data[].attributes.body
Veldig gøy aktivitet som viser hvordan datamaskinen kan sortere ting. Elevene kan bruke bøker (som skal sorteres i rekkefølge), tall eller lyder.
Link til opplegg her: https://www.csunplugged.org/en/topics/sorting-networks/reinforcing-numeracy-through-a-sorting-network-junior/

# data[].attributes.attachment_link.title
CS Unplugged - Sorting networks (sample classroom lesson)

# data[].attributes.body
Hvordan fungerer egentlig binære tall (som en datamaskin er bygget opp av). Denne aktiviteten kan er opplysende, selv for de voksne.
Link til opplegget her: https://www.csunplugged.org/en/topics/binary-numbers/

# data[].attributes.attachment_link.title
CS Unplugged - Binary digits (sample classroom lesson)

# data[].attributes.attachment_link.title
CS Unplugged - Parity magic (sample classroom lesson)

# data[].attributes.attachment_link.readable_text
Learning outcomes

Students will be able to:

Key questions

Why is it important to give very clear instructions? Have you ever been given unclear instructions and ended up doing the wrong thing? Why do you think computers need clear instructions?

Lesson starter

Ideally this lesson should take place around a large grid such as:

An outside painted chess board.

Grids in your classroom carpet.

Making masking tape grids one the floor in your classroom.

Draw a chalk grid either in your classroom or outside.

Ask for two volunteers and give yourself and them the roles of:

Role 1: The Developer (who writes the program) - The teacher will model this initially

Role 2: The Tester (who instructs the Bot and looks for bugs)

Role 3: The Bot (who runs the program)

Lesson activities

Teacher: "I'm going to be the programmer, but I'm going to need your help. We are programming the Bot, not just remote controlling it, because ALL the instructions are written before the Bot can follow those instructions."

"It's our job to write down clear instructions for the Bot, who is going to be (say the person's name). (Student's name) will be the Tester and is going to give the instructions to the Bot. The Tester will be on the lookout for bugs."

"First of all we need to decide, what programming language are we are going to use for this? I've chosen arrows to represent move forward, turn left and turn right."

"Debugging is fun because you get a chance to change your program after it's finished when you notice it's not working how you thought it should."

"First of all I need to decide, what programming language are we are going to use for this? I've chosen arrows to represent move forward, turn left and turn right."

If students aren't sure about the left and right direction, you can print the "left and right hand cards", and stick them to their shoes or have them hold them in their hands.

Have the Bot act out the individual instructions: forward means step one square forward, and left and right mean a 90 degree turn on the spot in the square (not moving to another square).

Teacher: "We're going to write our own program that gets the rocket to fly to Mars. The goal is to get the rocket to the square that Mars is in. Let's write the first two steps on the board together." (Draw two forward arrows.)

"So let's try that, and see what happens.

"Tester - could you please take these instructions and pass them onto the Bot. Be ready to underline what doesn't work when you see the Bot doing something that doesn't look right, and hand the whiteboard back to me to figure out how to fix the bug."

Teacher: "Bot - please pick up the rocket ready to receive the instructions for the tester." (The bot can carry a toy or token representing the rocket; or they can imagine that they are guiding it).

Tester then reads off the board: "move forward, move forward."
Rocket to Mars program:

"Tester, did the program run as you expected it to?" Depending on the tester's response, if it did then carry on programming, otherwise fix what didn't work and run that again. In this example the rocket should be in the square three to the left of Mars.

Now let's add to it. What would we program next?

Point to where the next piece of code needs to be added and add turn right, turn right. (This is deliberately incorrect.)
Rocket to Mars program:

I think it's ready to test now. Tester, please test my program (the programmer hands the program on the whiteboard to the tester and the bot should return to the starting square ready to rerun the program).

Teacher: Remember Tester, it's your job to find any "bugs" in my program. A bug is when my program isn't doing what was expected. Your job is to draw a line under the piece of code where you notice the instructions seem to be going wrong. You can stop the Bot at the point that you think there is a bug.

Tester then reads the instructions in the program off the board and the Bot executes them as they are read.

Teacher: "Excellent, you found a bug! I love finding bugs, so I can start solving them. Now class, let's work through this together to find my bug. Tester, you've done a great job finding it, but it's the programmer's job to find and fix the bug."

Once the bug has been identified then ask the Tester to test again. Ask the Bot to pick up the rocket and go back to the start position, then the Tester reads them the instructions.

Did we successfully program the rocket to land on Mars? How do we know?

Are there other ways we could have programmed the rocket to get to Mars? (There will be lots of ways; for example, Right, Forward, Forward, Forward, Left, Forward, Forward will work.) Discuss the programming options and test each one. What if we want the rocket to get to Mars, and then come back safely?

Teaching observations

Either set up your students to be working around the outside of your large grid, or you can use a smaller grid like a chessboard or the back of a 100s board (or print the grid provided with this lesson), in which case the bot moves a counter on the board instead of walking around the grid.

If you have multiple small grids, students can work independently in groups of three (programmer, tester, bot). If you are using a large grid, one group of students can work on their program while another tests theirs. Each group gets to try their program once, and then the next group has a turn while the previous one starts working on debugging their program.

Have the students choose their own two toys (one to be a space travelling object, the other to be the destination) and have them practise this task, as follows.

1. Place the traveller on a square on the edge of the grid, facing inwards.

2. Place the destination toy inside the grid.

3. The programmer writes down the program on a whiteboard.

4. The tester then takes the whiteboard and a different coloured whiteboard pen. The tester tells the Bot each instruction in the program. The tester puts a tick next to the code that is correct and underlines when the code is different to what the Bot should be doing. If this happens the Tester says "Stop" and the Bot stops and goes back to the start. The Tester gives the whiteboard to the Developer, who then debugs the code, and gives the Tester a revised version.

5. Repeat step 4 until the program is free of bugs and works as intended.

6. Change roles and move the Bot (space travelling object) starting point and the toy that represents the destination until everyone has had a turn.

The next challenge

Add barriers to the grid so that the path is more complex because the Bot needs to avoid the barriers. This could be space junk and comets, or you could invent a new scenario for the grid.

Other challenges

Have groups program the trip without using the left hand turn (i.e. the only instructions are Forward and Right turn.) Scaffold the students to realise that a left hand turn can be achieved by doing three Right turn instructions. Then challenge them to program with a Left turn but no Right turn.

Ask if they can write programs with only the Right and Left turn instructions (i.e. no Forward instruction)? (This isn't possible, as you would only be able to turn around on one square.)

Teaching observations

Eliminating one of the turn instructions highlights that different instruction sets can achieve the same thing, although some may be more convenient than others (for example, there are many different programming languages, but they can all do essentially the same kind of computation; it's just that some are better suited to some purposes than others.)

Implementing fewer instructions simplifies building a computer, and this can make it either faster or cheaper. For example, a very simple computer might have an addition instruction, but no multiply instruction; but if you need to do multiplication it can be achieved by doing lots of additions. Many common processors these days tend to have a small number of simple instructions (they are called Reduced Instruction Set Computers, or RISC) because it's more efficient than having lots of instructions (Complex Instruction Set Computers, or CISC).

Applying what we have just learnt

It's quite common to think that programming is some kind of special talent that people either have or don't have, but this couldn't be further from the truth! Like all skills, programming is something you learn through practise, making mistakes, and learning from them. The most important skill that programmers need is to be able to communicate with others, especially when they are finding and describing bugs. Bugs happen all the time in programming, so being able to identify where the bug occurs and problem solving how to fix it is incredibly important. It doesn't matter how experienced you are at programming, there will always be bugs that need to be found, and fixed. That's why the word "debugging" is so important to programmers.

Lesson reflection

Now that you are all programmers, what did you think was the most challenging part of being a programmer?

Throughout the lessons there are links to computational thinking. Below we've noted some general links that apply to this content.

Teaching computational thinking through CSUnplugged activities supports students to learn how to describe a problem, identify what are the important details they need to solve this problem, break it down into small logical steps so that they can then create a process which solves the problem, and then evaluate this process. These skills are transferable to any other curriculum area, but are particularly relevant to developing digital systems and solving problems using the capabilities of computers.

These Computational Thinking concepts are all connected to each other and support each other, but it's important to note that not all aspects of Computational Thinking happen in every unit or lesson. We've highlighted the important connections for you to observe your students in action. For more background information on what our definition of Computational Thinking is see our notes about computational thinking.

Decomposition

In our everyday lives we don't often give instructions as specifically as saying "Turn right, take a step forward, take another step forward, turn right", and it seems much more straightforward to simply say "please go over there". But when we program we have to be very specific because we have to tell computers exactly how to do each thing and limit ourselves to the few instructions that they can follow. Students need to work on taking something they are familiar with, like "go to that square" and identifying the simplest individual steps that need to happen for someone to accomplish this.

Also, programs can be written incrementally; instead of trying to solve the whole problem, students were encouraged to write a few steps first, test these, and then add to them. Breaking a program down into smaller components makes the task less overwhelming.

Examples of what you could look for:

Do students work on the problem incrementally? Can they take the action of "going to the left" and break it down further to the instructions "turn left, move forward"?

Evaluation

There is a clear way for students to evaluate their programs in this activity, which is simply to ask themselves "did it work?". By testing their programs they can evaluate whether their instructions accomplish the task.

There are multiple programs students could write that will get the Bot to the goal square, but some of these are probably more efficient than others. This could be measure be either the number of instructions, or the amount of time used.

Examples of what you could look for:

Did students recognise that multiple solutions (many different sets of instructions) are possible? Were they able to compare some and evaluate which ones use fewer commands and are the fastest? Are they able to see that measuring the time taken is a practical measure of the performance of a program, but counting the number of instructions is more consistent? (As it doesn't depend on who has the Bot and Tester roles).

# data[].attributes.attachment_link.description
Learning outcomes Students will be able to: Why is it important to give very clear instructions? Have you ever been given unclear instructions and ended up doing the wrong thing? Why do you think computers need clear instructions? Ideally this lesson should take place around a large grid such as: An outside painted chess board.

# data[].attributes.body
Gå en tur i nærmiljøet. Elevene skal samle ting de ser fra naturen. Etter turen får elevene mulighet til å sammenligne tingene de har funnet. Likheter, ulikheter, form, farge, funksjon osv. I denne aktiviteten øver elevene på å organisere, samle og gruppere objekter ut i fra ulike egenskaper.

Tingene som er samlet kan i ettertid brukes til å lage et bilde (feks med et mønster).

# data[].attributes.attachment_link.description
Children explore their surroundings and get creative, take a journey and make a map, and discover seaside tangrams, in these three fun activ

# data[].attributes.attachment_link.description
Computers today use digits to represent information - that’s why they’re called digital systems.
The simplest and most common way to represent digits is the binary number system, with just two digits (usually written as 0 and 1).
It is called binary because there are only two different digits used,…

# data[].attributes.body
I denne undervisningsøkta får elevene en analog introduksjon til Blue-bot programmering. De får introdusert begreper som bugs og programmering. De lærer å programmere, teste, lokalisere feil, rette, teste på nytt osv. En veldig fin introduksjonsøkt til videre arbeid med Blue-bot.

# data[].attributes.attachment_link.readable_text
Learning outcomes

Students will be able to:

Key questions

Why is it important to give very clear instructions? Have you ever been given unclear instructions and ended up doing the wrong thing? Why do you think computers need clear instructions?

Lesson starter

Ideally this lesson should take place around a large grid such as:

An outside painted chess board.

Grids in your classroom carpet.

Making masking tape grids one the floor in your classroom.

Draw a chalk grid either in your classroom or outside.

Ask for two volunteers and give yourself and them the roles of:

Role 1: The Developer (who writes the program) - The teacher will model this initially

Role 2: The Tester (who instructs the Bot and looks for bugs)

Role 3: The Bot (who runs the program)

Lesson activities

Teacher: "I'm going to be the programmer, but I'm going to need your help. We are programming the Bot, not just remote controlling it, because ALL the instructions are written before the Bot can follow those instructions."

"It's our job to write down clear instructions for the Bot, who is going to be (say the person's name). (Student's name) will be the Tester and is going to give the instructions to the Bot. The Tester will be on the lookout for bugs."

"First of all we need to decide, what programming language are we are going to use for this? I've chosen arrows to represent move forward, turn left and turn right."

"Debugging is fun because you get a chance to change your program after it's finished when you notice it's not working how you thought it should."

"First of all I need to decide, what programming language are we are going to use for this? I've chosen arrows to represent move forward, turn left and turn right."

If students aren't sure about the left and right direction, you can print the "left and right hand cards", and stick them to their shoes or have them hold them in their hands.

Have the Bot act out the individual instructions: forward means step one square forward, and left and right mean a 90 degree turn on the spot in the square (not moving to another square).

Teacher: "We're going to write our own program that gets the rocket to fly to Mars. The goal is to get the rocket to the square that Mars is in. Let's write the first two steps on the board together." (Draw two forward arrows.)

"So let's try that, and see what happens.

"Tester - could you please take these instructions and pass them onto the Bot. Be ready to underline what doesn't work when you see the Bot doing something that doesn't look right, and hand the whiteboard back to me to figure out how to fix the bug."

Teacher: "Bot - please pick up the rocket ready to receive the instructions for the tester." (The bot can carry a toy or token representing the rocket; or they can imagine that they are guiding it).

Tester then reads off the board: "move forward, move forward."
Rocket to Mars program:

"Tester, did the program run as you expected it to?" Depending on the tester's response, if it did then carry on programming, otherwise fix what didn't work and run that again. In this example the rocket should be in the square three to the left of Mars.

Now let's add to it. What would we program next?

Point to where the next piece of code needs to be added and add turn right, turn right. (This is deliberately incorrect.)
Rocket to Mars program:

I think it's ready to test now. Tester, please test my program (the programmer hands the program on the whiteboard to the tester and the bot should return to the starting square ready to rerun the program).

Teacher: Remember Tester, it's your job to find any "bugs" in my program. A bug is when my program isn't doing what was expected. Your job is to draw a line under the piece of code where you notice the instructions seem to be going wrong. You can stop the Bot at the point that you think there is a bug.

Tester then reads the instructions in the program off the board and the Bot executes them as they are read.

Teacher: "Excellent, you found a bug! I love finding bugs, so I can start solving them. Now class, let's work through this together to find my bug. Tester, you've done a great job finding it, but it's the programmer's job to find and fix the bug."

Once the bug has been identified then ask the Tester to test again. Ask the Bot to pick up the rocket and go back to the start position, then the Tester reads them the instructions.

Did we successfully program the rocket to land on Mars? How do we know?

Are there other ways we could have programmed the rocket to get to Mars? (There will be lots of ways; for example, Right, Forward, Forward, Forward, Left, Forward, Forward will work.) Discuss the programming options and test each one. What if we want the rocket to get to Mars, and then come back safely?

Teaching observations

Either set up your students to be working around the outside of your large grid, or you can use a smaller grid like a chessboard or the back of a 100s board (or print the grid provided with this lesson), in which case the bot moves a counter on the board instead of walking around the grid.

If you have multiple small grids, students can work independently in groups of three (programmer, tester, bot). If you are using a large grid, one group of students can work on their program while another tests theirs. Each group gets to try their program once, and then the next group has a turn while the previous one starts working on debugging their program.

Have the students choose their own two toys (one to be a space travelling object, the other to be the destination) and have them practise this task, as follows.

1. Place the traveller on a square on the edge of the grid, facing inwards.

2. Place the destination toy inside the grid.

3. The programmer writes down the program on a whiteboard.

4. The tester then takes the whiteboard and a different coloured whiteboard pen. The tester tells the Bot each instruction in the program. The tester puts a tick next to the code that is correct and underlines when the code is different to what the Bot should be doing. If this happens the Tester says "Stop" and the Bot stops and goes back to the start. The Tester gives the whiteboard to the Developer, who then debugs the code, and gives the Tester a revised version.

5. Repeat step 4 until the program is free of bugs and works as intended.

6. Change roles and move the Bot (space travelling object) starting point and the toy that represents the destination until everyone has had a turn.

The next challenge

Add barriers to the grid so that the path is more complex because the Bot needs to avoid the barriers. This could be space junk and comets, or you could invent a new scenario for the grid.

Other challenges

Have groups program the trip without using the left hand turn (i.e. the only instructions are Forward and Right turn.) Scaffold the students to realise that a left hand turn can be achieved by doing three Right turn instructions. Then challenge them to program with a Left turn but no Right turn.

Ask if they can write programs with only the Right and Left turn instructions (i.e. no Forward instruction)? (This isn't possible, as you would only be able to turn around on one square.)

Teaching observations

Eliminating one of the turn instructions highlights that different instruction sets can achieve the same thing, although some may be more convenient than others (for example, there are many different programming languages, but they can all do essentially the same kind of computation; it's just that some are better suited to some purposes than others.)

Implementing fewer instructions simplifies building a computer, and this can make it either faster or cheaper. For example, a very simple computer might have an addition instruction, but no multiply instruction; but if you need to do multiplication it can be achieved by doing lots of additions. Many common processors these days tend to have a small number of simple instructions (they are called Reduced Instruction Set Computers, or RISC) because it's more efficient than having lots of instructions (Complex Instruction Set Computers, or CISC).

Applying what we have just learnt

It's quite common to think that programming is some kind of special talent that people either have or don't have, but this couldn't be further from the truth! Like all skills, programming is something you learn through practise, making mistakes, and learning from them. The most important skill that programmers need is to be able to communicate with others, especially when they are finding and describing bugs. Bugs happen all the time in programming, so being able to identify where the bug occurs and problem solving how to fix it is incredibly important. It doesn't matter how experienced you are at programming, there will always be bugs that need to be found, and fixed. That's why the word "debugging" is so important to programmers.

Lesson reflection

Now that you are all programmers, what did you think was the most challenging part of being a programmer?

Throughout the lessons there are links to computational thinking. Below we've noted some general links that apply to this content.

Teaching computational thinking through CSUnplugged activities supports students to learn how to describe a problem, identify what are the important details they need to solve this problem, break it down into small logical steps so that they can then create a process which solves the problem, and then evaluate this process. These skills are transferable to any other curriculum area, but are particularly relevant to developing digital systems and solving problems using the capabilities of computers.

These Computational Thinking concepts are all connected to each other and support each other, but it's important to note that not all aspects of Computational Thinking happen in every unit or lesson. We've highlighted the important connections for you to observe your students in action. For more background information on what our definition of Computational Thinking is see our notes about computational thinking.

Decomposition

In our everyday lives we don't often give instructions as specifically as saying "Turn right, take a step forward, take another step forward, turn right", and it seems much more straightforward to simply say "please go over there". But when we program we have to be very specific because we have to tell computers exactly how to do each thing and limit ourselves to the few instructions that they can follow. Students need to work on taking something they are familiar with, like "go to that square" and identifying the simplest individual steps that need to happen for someone to accomplish this.

Also, programs can be written incrementally; instead of trying to solve the whole problem, students were encouraged to write a few steps first, test these, and then add to them. Breaking a program down into smaller components makes the task less overwhelming.

Examples of what you could look for:

Do students work on the problem incrementally? Can they take the action of "going to the left" and break it down further to the instructions "turn left, move forward"?

Evaluation

There is a clear way for students to evaluate their programs in this activity, which is simply to ask themselves "did it work?". By testing their programs they can evaluate whether their instructions accomplish the task.

There are multiple programs students could write that will get the Bot to the goal square, but some of these are probably more efficient than others. This could be measure be either the number of instructions, or the amount of time used.

Examples of what you could look for:

Did students recognise that multiple solutions (many different sets of instructions) are possible? Were they able to compare some and evaluate which ones use fewer commands and are the fastest? Are they able to see that measuring the time taken is a practical measure of the performance of a program, but counting the number of instructions is more consistent? (As it doesn't depend on who has the Bot and Tester roles).

# data[].attributes.attachment_link.description
Learning outcomes Students will be able to: Why is it important to give very clear instructions? Have you ever been given unclear instructions and ended up doing the wrong thing? Why do you think computers need clear instructions? Ideally this lesson should take place around a large grid such as: An outside painted chess board.

# data[].attributes.attachment_link.readable_text
Printables

Classroom resources

Learning outcomes

Students will be able to:

Key questions

What different number systems do we know about? (Answers might include: Roman Numerals; Tally marks; Number bases like binary, octal and hexadecimal; Language based systems like Chinese or Ancient Egyptian.)

Why do we normally use 10 digits? (Probably because we have 10 fingers, plus it's a fairly efficient way to write things compared with, say, tally marks.)

Why do we have different number systems? (They are convenient for different things e.g. tally marks are easy if you are counting; Roman numerals can be useful for making a number look more mysterious or harder to read.)

Lesson starter

See teaching this in action

Note from the authors

We've noticed that once students understand how the binary number system works, they have many questions and are excited to explore the concepts outlined in this lesson further. We've added a lot of information into this lesson, however, it is not our intention that you will teach and cover all the concepts, but that you have at your fingertips the information you need when your students express an interest in learning more.

Notes on resources

There is also an online interactive version of the binary cards here, from the Computer Science Field Guide, but it is preferable to work with physical cards.

1. Hold the first 5 cards (1, 2, 4, 8 and 16 dots), but don't let students see the dots. Ask for 5 students to volunteer to be "bits", and have them stand in a line in front of the class.

2. Hand out the 1-dot card to the person on the right. Explain that they are one "bit" (binary digit), and can be on or off, black or white, 0 or 1 dots. The only rule is that their card is either completely visible, or not visible (i.e. flipped over). Hand out the second card to the second person from the right. Point out that this card has either 2 dots (visible), or none (upside down).

3. Ask the class what the number of dots on the next card will be. Get them to explain why they think that.

Teaching observations

Students will usually suggest it should be three. If they suggest 4, they have probably done the activity before (or have seen the cards you are holding!) If they suggest the wrong number, don't correct them, but continue without comment, so that they can construct the rule for themselves.

4. Silently give out the four-dot card, and let them try to see the pattern.

Teaching observations

Usually some students will complain that you've missed out the three, but simply indicate that you haven't made a mistake. This gives them the opportunity to try to construct the pattern for themselves.

5. Ask what the next card is, and why.

Teaching observations

At this point it is common for students to guess that it is 6 (since it follows the numbers 2 and 4). However, if you let them think about it a little more, some will usually come up with 8, and those students should be able to convince the others that they are correct (there are several ways a student could explain this e.g. that each card is double the previous one, or that if you take two of a card, you get the next one)

6. Students should be able to work out the fifth card (16 dots) without help:

7. How many dots would the next card have if we carried on to the left? (32) The next...? (There's no need to have students hold these cards, as they won't be used in the next part of the activity, but you can show them to confirm that they are correct).

8. Continue with 64 and 128 dots.

Teaching observations

At 128 dots there would be 8 cards. This is 8 bits, which is commonly referred to as a byte. It may be distracting to bring this up at this point, but some students may already be familiar with the idea that 8 bits is a byte, and make that observation. However, in the meantime, we'll work with a 5-bit representation, which isn't as useful as a whole byte, but a good size for teaching. (A byte is a convenient grouping of bits, and usually computer storage is based around bytes rather than individual bits; it's just the same as eggs being sold as a dozen; they could be sold individually, but groups of a dozen are usually more convenient for everyone concerned.)

A common mistake is to hand out the cards from left to right, but it's convention in number representation that the least significant value is on the right, and this is an important idea for students to take away from this activity.

Lesson activities

1. Remind the students that the rule is that a card either has the dots fully visible, or none of them are visible. If we can turn cards on and off by showing the front and back of the card, how would we show exactly 9 dots? Begin by asking if they want the 16 card (they should observe that it has too many dots), then the 8 card (they will likely reason that without it there aren't enough dots left), then 4, 2 and 1. Without being given any rules other than each card being visible or not, students will usually come up with the following representation.

Mathematical links

Base 10 (our counting system) has 10 digits, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. When we count in base 10, we count from 0 to 9 and then run out of digits. So we need to add another column; we put a 1 in that column and start counting again from 0. This makes the number 10, we then repeat that process until the tens column is 9 and the ones column is 9 (making 99); from there we then add another column. Hence we have the familiar place value system that can be shown something like this:

100,000s | 10,000s | 1,000s | 100s |10s | 1
Note: Use the appropriate place value example based on what you have already taught in your class; this is an extended example.
Base 2 (binary) follows the same logic, except it moves a lot quicker to the "next" place value, because there are only two digits, 0 and 1. The binary place values look like this:

32 | 16 | 8 | 4 | 2 | 1 |

Sometimes students confuse the order of digits in a binary representation. To support students to understand the correct ordering of binary digits, ask the question: If I was going to give you $435.00 which number are you most interested in? Is it the 4 or the 5? Why is that? It's the same for binary code, the lowest value (least significant digit) is on the far right, whereas the most significant digit is on the far left.

2. Now ask "How would you make the number 21?" (Again, start by asking if they want the 16 card, then the 8 card, and so on from left to right).

3. This is an algorithm for converting numbers to a binary representation. Let's think through the steps to do this together.

a. Start with all the numbers switched to on (dots showing).

b. Consider representing the number 10

c. Does 16 fit into 10? No - so turn it off

d. Does 8 fit into 10? Yes - so keep it on. How many are left over? (2)

e. Does 4 fit into 2? No - so turn it off

f. Does 2 fit into 2? Yes - so keep it on. How many are left over? (None)

g. So turn off 1.

Applying what we have just learnt

Group students into pairs.

Give each pair a set of the smaller binary cards (either 5 or 6 cards, depending on the range of numbers they are comfortable with).

Starting with just 5 cards, have them practise the algorithm (deciding about each card from left to right) for numbers such as 20, 15, and 8.

1. Explain to students that we're working with just two digits, so they are called binary digits. They are so common that we have a short name for them: write "binary digit" on a piece of paper, then rip off the "bi" at the start, and the "t" at the end, put it together and ask what the combined word ("bit") spells. This is the short name for a binary digit, so the 5 cards that they have are actually 5 bits.

2. Now let's count from the smallest number we can make up to the highest number:

a. What is the smallest number? (they may suggest 1, then realise that it's 0).

3. Get the number zero displayed on the cards (i.e. no dots showing).

4. Now count up 1, 2, 3, 4 .... (each pair should work out these numbers between them).

5. Once they start to get into a routine, ask: how often are we seeing the 1-dot card? (every second time, which is every odd number)

a. What other patterns are we seeing? (some may observe that the 2-dot card flips on every second count, the 4-dot on every 4th and so on; so the 16 dot card doesn't do much!)

6. Continue until all the cards are switched to "on" and have counted to 31. What happens next? (We have to add a new card.) How many dots on it? (32) What do we have to do to the other 5 cards when we get to 32? (we have to turn them all off)

7. Let's explore this further ...

a. So when I have two bits I can make a maximum of? (3)

b. I add another bit and that has how many dots on it? (4)

c. I turn off the first two bits to make 4 right?

d. Now let's turn on all three bits, so now we have how many? (7)

e. I add another bit and that has how many dots on it? (8)

f. Repeat until a pattern is recognised that the number on the next card to the left is one more than the total number of dots on all the cards to the right (e.g. there are 15 dots on the 8, 4, 2 and 1 cards, so the next card to the left is 16). This makes it easy to work out the number if all the bits are switched on - double the left-hand card, and subtract 1.

g. How many different numbers can I make with two bits? (4; often students will say 3 because they haven't counted 0)

h. Let's add the next bit; how many different numbers can we make now? (8, again 7 will often be given as an answer first)

i. Repeat until a pattern is recognised that each time we add another bit we can now represent twice as many numbers.

Teaching observations

A concept that students may struggle with here is that the number of values is one more than the maximum value (e.g. from 0 to 7, there are 8 different numbers). The same observation occurs with the number of digits in conventional decimal numbers; the largest digit is 9, but there are 10 possible digits (counting 0). This is sometimes called the fencepost problem (the number of fence posts is one more than the number of gaps between them), and it comes up a lot in computing.

Lesson Reflection

Would this activity work if we used white and cream cards? Why? Why not? (In principle you could use these, but it wouldn't be a good idea. We are looking for the answer that they are not contrasting colours, therefore it would be difficult to see if it is actually on or off. This hints why computers use easily distinguished physical representations.)

What are some contrasting symbols or ways that we can show on and off in binary?

(Ideas could include holding the cards up high, or down low; simply holding up a hand; sitting down or standing up; or using a different representation such as lights that are on or off.)

Computers are cheaper and easier to build if they represent data with just two contrasting values, which we represent as the numbers 0 and 1. What else could we use to represent two opposites in writing? (Perhaps a cross or tick; happy or sad face; or any other pair of symbols.)

Extending this idea, the numbers might be represented by a voltage that is either close to 5 volts, or close to 0 volts. The circuitry is built so that anything less than about 2.5 volts counts as 0 and anything over 2.5 volts counts as 1. Like the contrasting colours of the cards, this is very easy to recognise. We could have had 10 colours of cards to represent the digits from 0 to 10, and we could have ten voltage ranges (0 to 0.5, 0.5 to 1.0 and so on), but it's way more complicated to build fast and accurate circuitry for this.

Throughout the lessons there are links to computational thinking. Below we've noted some general links that apply to this content.

Teaching computational thinking through CSUnplugged activities supports students to learn how to describe a problem, identify what are the important details they need to solve this problem, break it down into small logical steps so that they can then create a process which solves the problem, and then evaluate this process. These skills are transferable to any other curriculum area, but are particularly relevant to developing digital systems and solving problems using the capabilities of computers.

These Computational Thinking concepts are all connected to each other and support each other, but it's important to note that not all aspects of Computational Thinking happen in every unit or lesson. We've highlighted the important connections for you to observe your students in action. For more background information on what our definition of Computational Thinking is see our notes about computational thinking.

Algorithmic thinking

We used an algorithm in this lesson to convert a decimal number to a binary one. This is an algorithm because it is a step-by-step process that will always give the right solution for any input you give it as long as the process is followed exactly.

Here's an algorithm for working out which dot cards should be showing, written in text:

Find out the number of dots that is to be displayed. (We'll refer to this as the "number of dots remaining", which initially is the total number to be displayed.)

For each card, from the left to the right (i.e. 16, 8, 4, 2 then 1):

If the number of dots on the card is more than the number of dots remaining:

Otherwise:

Show the card

Subtract the number of dots on the card from the number of dots remaining

Note that this algorithm (working from right to left) works very well with the cards, but if you look up computer programs for doing this, you may encounter a different one that works from right to left. It's usual to have multiple algorithms that achieve the same thing.

Examples of what you could look for:

Which students are methodical when they convert between decimal and binary? Which ones start with the leftmost card and move one card at a time to the right, rather than choosing cards at random and flipping them on and off until they get the right number?

Abstraction

Binary number representation (just using 0 and 1) is an abstraction that hides the complexity of the electronics and hardware inside a computer that store data. Abstraction helps us simplify things because we can ignore the details we don't currently need to know.

In this case the details we can ignore include: Computers use physical devices like electronic circuits and voltages in circuits to store and move data, and there are many complex physics and mathematical theories that make this work.

We don't need to understand how these circuits work to use data and represent things using binary. Using binary is an Abstraction of these circuits and allows us to represent numbers as being made out of bits (0s and 1s), to understand data and work out problems without having to think about what is happening 'underneath the hood' of the computer.

Another use of abstraction is considering what is needed to represent any given digit in binary. The answer is all you need are two different things. These things can be anything! Two different colours, two different animals, two different symbols etc. As long as there are two of them, and they are different, you can use these to represent any number, using binary, the same way a computer uses electricity to represent data.

We can use binary digits to represent any type of data stored on a computer. When we represent other forms of data (such as letters, images, and sound) we also use abstraction because we hide the details of all the binary numbers underneath and just look at the whole piece of data. All forms of data end up being represented as numbers (which in turn are really just combinations of bits) - for text we have a number for each letter, for images we use a number for each colour, and so on. We are using multiple layers of abstraction! For example, a familiar form of abstraction is that the month "October" could be represented by the number ten, which in turn is represented by the bits 01010, and if these are stored as voltages in computer memory, it is ultimately "low, high, low, high, low" for the voltages.

Examples of what you could look for:

Who are the students that demonstrate converting and representing binary numbers using things other than "1's and 0's", "black and white", and "off and on" (for example using :) and :(, or using people standing up or sitting down). If you are able to interchange terms like "black" and "white" with 0 and 1 without students being concerned about the difference, they are exercising abstraction.

Decomposition

An example of decomposition is breaking the conversion of the number to binary into one bit at a time. The questions "Should this be 1 or 0" for each of the dot cards is decomposing the problem to a series of questions.

Examples of what you could look for:

Which students recognise that it is important to start with the leftmost card and only consider one bit at a time? Which students focus on each individual bit at a time, rather than being overwhelmed by trying to work them all out in one go?

Generalising and patterns

Recognising patterns in the way the binary number system works helps give us a deeper understanding of the concepts involved, and assists us in generalising these concepts and patterns so that we can apply them to other problems.

At a simple level, we started with the numbers 1, 2, and 4, and students generalised that to doubling values. The exercise used 5-bit numbers, but students should be able to generalise that to 8-bit numbers, or larger.

The algorithm for converting a decimal number to a binary one follows a pattern that can be generalised to solve the problem of giving change when someone pays by cash. For binary numbers you start with the largest bit always turn a bit on if you need it, just like when you're giving change you start with the largest denomination and then always take a coin (or note) whenever you need it. Jargon note: This is called a greedy algorithm - it takes as much as it can each time!

Mathematical links

Ask students what is special about the decimal to binary conversion, in contrast with the general change giving algorithm, and have them observe that in the general case you may need to give more than one coin of the same denomination, whereas in the binary conversion there is always one (or none) of each.

When counting upwards in binary, there is a pattern for how often particular cards flip. The 1st bit (with 1 dot) turns over every time, the 2nd (with 2 dots) turns for every second number, the 3rd (with 4 dots) turns for every 4th... Is there a pattern like this when we count in decimal numbers?

If you have 5 of the cards and all are visible, you will have the number 31, which is 1 less than the value of the next card, 32. Is this pattern always true?

The amount of numbers you can represent with a certain number of bits is the same as the value of the next bit that can be added. For example, using 4 cards (1, 2, 4, 8) you can represent 16 different numbers (0-15), and the next card in the sequence is the number 16. Each time we add the next card we also double the amount of different numbers we can represent.

Working with these patterns is valuable for working out the relationship between the number of bits being used and the power of what they can represent.

Explain one or more of the following patterns:

That with a certain number of cards you can make the same amount of different numbers as the number of dots that would be on the next card to be added on the left (remember that 0 is a number).

When you are counting upwards: the first card (1 dot) turns over every time, the second card (2 dots) turns every two times, the third (4 dots), every four times, and the fourth (8 dots), every eight times...

That when all the cards you have are visible it will add up to the next binary card number minus 1.

Examples of what you could look for:

Which students recognised quickly that each card was doubling the number of dots? Can students see the similarities between this and multiplying place values by 10 when they are using the decimal system?

Which students easily understand the patterns of cards flipping when counting with binary numbers?

Logic

Logical thinking means using rules you already know and using logic to deduce more rules and information from these. Once we know what number each of the binary cards represents then we can use this knowledge to figure out how to represent other numbers with the cards. If you memorise how to represent the numbers we can make with 5 cards, does that mean you understand how to represent any number with any number of bits? It doesn't, but you can understand how to do that if you understand the logic behind how these numbers with the 5 cards are made.

A good example of logical thinking in binary numbers is the reasoning for why each bit "has to" have a particular value (e.g. it has to be 1, or it has to be 0) to represent a given number. This in turn leads to understanding that there is only one representation for each number.

Examples of what you could look for:

Do students explicitly explain that the right-most bit needs to be a one because it is the only odd number and therefore is needed so that we are able to make any, and all, odd numbers? Without it we could only make even numbers.

Are students able to explain that each card "has to" be up the way it is for a given number e.g. the 16-dot card is needed for the number 19 because without it you only have 15 dots remaining to its right (not enough); but the 16 card isn't needed for the number 9 because it would give too many dots?

Evaluation

An example of evaluation is working out how many different values can be represented by a given number of bits (e.g. 5 bits can represent 32 different values), and vice versa (to represent 1000 different values, you need at least 10 bits).

Examples of what you could look for:

Can a student work out the range possible with 4 bits? (16)

6 bits? (64)

8 bits? (256)

If we add one more bit to a representation, how much does that increase the range? (it doubles it)

If we add two more bits to a representation, how much does that increase the range? (it is four times as much)

How many bits do we need to represent 1000 different values? (10 is sufficient)

# data[].attributes.attachment_link.description
Learning outcomes Students will be able to: What different number systems do we know about? (Answers might include: Roman Numerals; Tally marks; Number bases like binary, octal and hexadecimal; Language based systems like Chinese or Ancient Egyptian.) Why do we normally use 10 digits?

# data[].attributes.body
Bruke algoritmer for å lære en dans. Dette så ut som en morsom måte å jobbe med algoritmer på.

# data[].attributes.body
Kjekk aktivitet henta frå Kodeklubben.

# data[].attributes.attachment_link.description
Pupils will create sequences of colours to make music, learning that the order of the instructions is important.

# data[].attributes.attachment_link.readable_text
Kortstokken er en analog kodeoppgave hvor en arbeider med elevenes forståelse av vilkår/betingelser og samtidig ser på hvorfor en datamaskin er mye bedre enn et menneske til å håndtere en større mengde vilkår/betingelser.

For aktiviteten trenger du en kortstokk. Gjerne en kortstokk med store kort, eventuelt en kortstokk på en skjerm.

Læringsmål:
- lære hva et vilkår er og hvordan det fungerer i virkeligheten
- utforske hvordan vilkår/betingelser fungerer, og se på forskjellen mellom mennesker og datamaskinen vises i en slik sammenheng

Introduksjon - vi mennesker er flink til å reagere på ulike input, men reaksjonen er som oftest basert på ting vi har lært opp gjennom årene våre. Men hva om vi skal lære noe helt nytt, hvor mange ting kan vi kontrollere da? 2, 3, 6, 8? Hvordan er det så med en datamaskin? Hvor mange vilkår kan den håndtere?

Aktivitet 1 - I en kortstokk er det to ulike farger. Rødt og svart. Bli enige med elevene om hva som skal skje når du trekker et rødt kort og hva som skal skjer når vi trekker et svart kort. F.eks rope "Hei" på rødt og "Ha det" på svart, eller klappe ved rødt og vinke ved svart.

Aktivitet 2 - Nå skal vi legge til et vilkår. Om kortet er rødt, og har verdien 10 eller over 10, skal en ny aktivitet skje. Er det kortet rødt og under 10, skal den samme aktivitet skje som i sted. Fortsatt vil de aller fleste elevene klare å henge med, da antallet vilkår og ulike utfall fortsatt er håndterlig. Aktiviteten skal heller ikke repeteres mange ganger, før det vil sitte.

Aktivitet 3 - Vi utvider nå aktiviteten og utvider med noen flere vilkår. Nå skal hver ulike korttype få sitt eget vilkår. Altså vil Hjerter få sin aktivitet, ruter sin aktivitet, spar sin aktivitet og kløver sin aktivitet. Fysiske aktiviteter er å anbefale, som f.eks fram, tilbake, stå i ro og legg deg ned (alias oppgave som har pleid å være en del av Mesternes Mester). Nå vil flere elever merke at det er vanskelig å huske hva de skal gjøre for de ulike korttypene. Vil en datamaskin ha det problemet?

Utvid med flere aktiviteter og flere vilkår. Hver aktivitet kan med fordel repeteres flere ganger, med ulike utfall på vilkåret.

Oppsummering - Samtale med elevene om hvor mange vilkår de følte var behagelig å håndtere, hvor lenge de hadde kontroll, hvor mange de tror et menneske kan håndtere og hvorfor det er slik. Samtale også om hvordan de tror en datamaskin håndtere dette, og om det finnes en begrensning i hvor mange vilkår en datamaskin kan håndtere.

# data[].attributes.attachment_link.description
Kortstokken er en analog kodeoppgave hvor en arbeider med elevenes forståelse av vilkår/betingelser og samtidig ser på hvorfor en datamaskin er mye bedre enn et menneske til å håndtere en større mengde vilkår/betingelser. For aktiviteten trenger du en kortstokk. Gjerne en kortstokk med store kort, eventuelt en kortstokk på en skjerm.

# data[].attributes.body
i denne undervisningen utforsker vi hvordan bilder kan bli representert av tall. og vi lærer at alle bilder vi ser på datamaskinen er bygget opp av pixler og at fargene på pikslene er bestemt av sifre

# data[].attributes.attachment_link.readable_text
Printables

Classroom resources

Learning outcomes

Students will be able to:

Key questions

How do you think computers display images on a screen?

How do computers store images if they store all information as digits?

Lesson starter

This lesson includes two activities: one that students complete individually and one group activity. In each activity you will need enough colouring pages for one per student. These each require different versions of the Pixel Painter worksheets. Use the Black and White colouring type (the first option on the list), and:

For the first activity choose from the 1 page images (the star, teacup, or cat). You can use a combination of these images, students do not all need to complete the same one,

For the second activity choose from the 6, 8, and 9 page images. Print enough for one set of image worksheets per group of students.

Notes on resources

Print spare copies of each worksheet in case students make mistakes and need a new one.

Use the Black and White (2 possible binary values) colouring option, not the option which says "in Run Length Encoding".

Students can use a black colouring pencil, crayon, or felt tip pen, but easily erasable pencils work much better for the first time students do this activity.

Teacher to class: Computer screens are divided up into a grid of small squares, each of which can display a colour. We call these squares picture elements, or pixels.

Write the words "picture elements" on the board. To show how we get the word pixels, circle the "pi" of picture and the "el" of elements, and write "pixel" underneath.

Teacher to class: Each of these pixels can be a different colour, and when we have a lot of them on a screen they form an image. Has anyone heard of pixels before? What about megapixels?

Teaching observations

Megapixel means one million pixels. Students may have heard the term "megapixels" before because cameras are often described as being a certain number of megapixels, for example a phone might have a 12-megapixel camera. This describes the resolution of the photos a camera can take. A 12-megapixel camera can produce an image with 12 million pixels in it.

Television screens and data projectors also display images using pixels.

Teacher to class: Every image we see on a screen, whether it is a picture, a video, or text, is shown using pixels, and all a computer needs to store is what colour each of the pixels on the screen should be.

Show the following images to students on a screen or on the board.

Teacher to class: In a black and white image, each pixel can be either black or white, so all the computer would need to store is which dots are black and which are white. For example, if we wanted to display the letter C, we first need to divide the letter into squares. If we zoom in further and further on the letter we can see a grid of pixels similar to these:

We can represent this image using binary digits (bits). If a 1 indicates a white square and a 0 indicates a black square then we can represent our letter C, on a 5x6 pixel grid, like this:
10001, 01110, 01111, 01111, 01110, 10001
If we take these numbers and draw the image they represent we get the letter C:

We are using 1 to represent white and 0 to represent black, in the same way we used white and black cards to represent 'on' and 'off' in the binary numbers unit.

Lesson activities

Hand out the 1 page image worksheets to students and ask them to look at the grid of squares. What do they notice about the numbers in the squares? They are all 1's or 0's.

Teacher to class: The grid on these sheets represents the pixels on a computer screen. Now you are going to be the computer and use the digits in the squares to make an image.

On the worksheets, have students colour in each square with a 0 in it black, and leave each square with a 1 blank so that it is white. We are using 1 to represent white and 0 to represent black, because 1 indicates that a pixel is 'on' (and therefore white) and a 0 indicates it is 'off' (and so it is black). By colouring the 0 squares in this activity, students are effectively 'turning off' those pixels. Advise them to colour them in lightly at first, and then when they are sure they have not made any mistakes they can colour them in fully. As they work through the worksheet they should see an image emerging.

Teacher to class: Now that we have made some simple images with our numbers and pixels, we can try making some more detailed and complicated ones. How do you think we could make more detailed images?

Teaching observations

Possible answers include adding more colours. This is a good answer and colours are part of more advanced lessons in this unit, but this lesson only focusses on black and white pixels, so bring students back to this and ask them how they can make a more detailed black and white image.

The may also suggest using smaller pixels for the same image they coloured in. This is a good answer and could be an idea for students to explore with in subsequent classes. For now we are looking at creating other more complicated and detailed images, rather than making the previous ones more detailed though.

The answer you are looking for is to use more pixels for the image, which is what students will do in this next activity.

Put students into groups and give each group a set of the multipage image worksheets, so that each student has a page to work on. If this is not possible with the number of students you have just make sure groups are small enough for each students to have at least one page, or preferably for each student to have the same number of pages. For example, have groups of 3 work on a 6 page image, so each student has 2 pages to complete.

Teacher to class: These sets of grids can all be put together to create one larger image, which contains much more pixels than the previous ones. You are each going to colour in the pixels on your own sheet, in the same way as before, and then put the whole image together.

Once students have coloured in their sheets they can arrange them together to create the whole image. There are diagrams on the worksheet printables which teachers can use to help students put their images together if they get stuck.

Applying what we have just learnt

Students could use a grid or graph paper to create their own images. Have students write out the binary digits that represent their image (in the same way as the 'C' in the lesson starter section, instead of writing the 1's and 0's into each of the boxes on the grid), give this to other students, and see if they can recreate the same picture.

There are a number of websites avaliable that students can use to easily create pixel art. They can create their own pixel art, convert this into a grid of digits, and then have their friends try to recreate their image.

Now that students have tried creating the larger images they could take it a step further and make an image as a whole class. The Pixel Painter Parrots option is made up of 32 pages, and is a great challenge for a class.

Notes on resources

There is an 8 by 8 grid in the printables section which can be used for drawing these images.

Lesson reflection

This lesson has just covered black and white images; why can't we do more than two colours with this activity?

With one binary digit we can only represent two different values. This means if we use one digit to represent the colour of one pixel, then each pixel can only be one of two different colours.

What could we do to represent more colours?

If we want each pixel to be able to show more colours other than black and white then we need to use more numbers (i.e. more binary digits) to represent the colour of each pixel. This will be explored in future lessons.

# data[].attributes.attachment_link.description
Learning outcomes Students will be able to: How do you think computers display images on a screen? How do computers store images if they store all information as digits? This lesson includes two activities: one that students complete individually and one group activity. In each activity you will need enough colouring pages for one per student.

# data[].attributes.attachment_link.readable_text
Printables

Classroom resources

Learning outcomes

Students will be able to:

Key questions

What different number systems do we know about? (Answers might include: Roman Numerals; Tally marks; Number bases like binary, octal and hexadecimal; Language based systems like Chinese or Ancient Egyptian.)

Why do we normally use 10 digits? (Probably because we have 10 fingers, plus it's a fairly efficient way to write things compared with, say, tally marks.)

Why do we have different number systems? (They are convenient for different things e.g. tally marks are easy if you are counting; Roman numerals can be useful for making a number look more mysterious or harder to read.)

Lesson starter

See teaching this in action

Note from the authors

We've noticed that once students understand how the binary number system works, they have many questions and are excited to explore the concepts outlined in this lesson further. We've added a lot of information into this lesson, however, it is not our intention that you will teach and cover all the concepts, but that you have at your fingertips the information you need when your students express an interest in learning more.

Notes on resources

There is also an online interactive version of the binary cards here, from the Computer Science Field Guide, but it is preferable to work with physical cards.

1. Hold the first 5 cards (1, 2, 4, 8 and 16 dots), but don't let students see the dots. Ask for 5 students to volunteer to be "bits", and have them stand in a line in front of the class.

2. Hand out the 1-dot card to the person on the right. Explain that they are one "bit" (binary digit), and can be on or off, black or white, 0 or 1 dots. The only rule is that their card is either completely visible, or not visible (i.e. flipped over). Hand out the second card to the second person from the right. Point out that this card has either 2 dots (visible), or none (upside down).

3. Ask the class what the number of dots on the next card will be. Get them to explain why they think that.

Teaching observations

Students will usually suggest it should be three. If they suggest 4, they have probably done the activity before (or have seen the cards you are holding!) If they suggest the wrong number, don't correct them, but continue without comment, so that they can construct the rule for themselves.

4. Silently give out the four-dot card, and let them try to see the pattern.

Teaching observations

Usually some students will complain that you've missed out the three, but simply indicate that you haven't made a mistake. This gives them the opportunity to try to construct the pattern for themselves.

5. Ask what the next card is, and why.

Teaching observations

At this point it is common for students to guess that it is 6 (since it follows the numbers 2 and 4). However, if you let them think about it a little more, some will usually come up with 8, and those students should be able to convince the others that they are correct (there are several ways a student could explain this e.g. that each card is double the previous one, or that if you take two of a card, you get the next one)

6. Students should be able to work out the fifth card (16 dots) without help:

7. How many dots would the next card have if we carried on to the left? (32) The next...? (There's no need to have students hold these cards, as they won't be used in the next part of the activity, but you can show them to confirm that they are correct).

8. Continue with 64 and 128 dots.

Teaching observations

At 128 dots there would be 8 cards. This is 8 bits, which is commonly referred to as a byte. It may be distracting to bring this up at this point, but some students may already be familiar with the idea that 8 bits is a byte, and make that observation. However, in the meantime, we'll work with a 5-bit representation, which isn't as useful as a whole byte, but a good size for teaching. (A byte is a convenient grouping of bits, and usually computer storage is based around bytes rather than individual bits; it's just the same as eggs being sold as a dozen; they could be sold individually, but groups of a dozen are usually more convenient for everyone concerned.)

A common mistake is to hand out the cards from left to right, but it's convention in number representation that the least significant value is on the right, and this is an important idea for students to take away from this activity.

Lesson activities

1. Remind the students that the rule is that a card either has the dots fully visible, or none of them are visible. If we can turn cards on and off by showing the front and back of the card, how would we show exactly 9 dots? Begin by asking if they want the 16 card (they should observe that it has too many dots), then the 8 card (they will likely reason that without it there aren't enough dots left), then 4, 2 and 1. Without being given any rules other than each card being visible or not, students will usually come up with the following representation.

Mathematical links

Base 10 (our counting system) has 10 digits, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. When we count in base 10, we count from 0 to 9 and then run out of digits. So we need to add another column; we put a 1 in that column and start counting again from 0. This makes the number 10, we then repeat that process until the tens column is 9 and the ones column is 9 (making 99); from there we then add another column. Hence we have the familiar place value system that can be shown something like this:

100,000s | 10,000s | 1,000s | 100s |10s | 1
Note: Use the appropriate place value example based on what you have already taught in your class; this is an extended example.
Base 2 (binary) follows the same logic, except it moves a lot quicker to the "next" place value, because there are only two digits, 0 and 1. The binary place values look like this:

32 | 16 | 8 | 4 | 2 | 1 |

Sometimes students confuse the order of digits in a binary representation. To support students to understand the correct ordering of binary digits, ask the question: If I was going to give you $435.00 which number are you most interested in? Is it the 4 or the 5? Why is that? It's the same for binary code, the lowest value (least significant digit) is on the far right, whereas the most significant digit is on the far left.

2. Now ask "How would you make the number 21?" (Again, start by asking if they want the 16 card, then the 8 card, and so on from left to right).

3. This is an algorithm for converting numbers to a binary representation. Let's think through the steps to do this together.

a. Start with all the numbers switched to on (dots showing).

b. Consider representing the number 10

c. Does 16 fit into 10? No - so turn it off

d. Does 8 fit into 10? Yes - so keep it on. How many are left over? (2)

e. Does 4 fit into 2? No - so turn it off

f. Does 2 fit into 2? Yes - so keep it on. How many are left over? (None)

g. So turn off 1.

Applying what we have just learnt

Group students into pairs.

Give each pair a set of the smaller binary cards (either 5 or 6 cards, depending on the range of numbers they are comfortable with).

Starting with just 5 cards, have them practise the algorithm (deciding about each card from left to right) for numbers such as 20, 15, and 8.

1. Explain to students that we're working with just two digits, so they are called binary digits. They are so common that we have a short name for them: write "binary digit" on a piece of paper, then rip off the "bi" at the start, and the "t" at the end, put it together and ask what the combined word ("bit") spells. This is the short name for a binary digit, so the 5 cards that they have are actually 5 bits.

2. Now let's count from the smallest number we can make up to the highest number:

a. What is the smallest number? (they may suggest 1, then realise that it's 0).

3. Get the number zero displayed on the cards (i.e. no dots showing).

4. Now count up 1, 2, 3, 4 .... (each pair should work out these numbers between them).

5. Once they start to get into a routine, ask: how often are we seeing the 1-dot card? (every second time, which is every odd number)

a. What other patterns are we seeing? (some may observe that the 2-dot card flips on every second count, the 4-dot on every 4th and so on; so the 16 dot card doesn't do much!)

6. Continue until all the cards are switched to "on" and have counted to 31. What happens next? (We have to add a new card.) How many dots on it? (32) What do we have to do to the other 5 cards when we get to 32? (we have to turn them all off)

7. Let's explore this further ...

a. So when I have two bits I can make a maximum of? (3)

b. I add another bit and that has how many dots on it? (4)

c. I turn off the first two bits to make 4 right?

d. Now let's turn on all three bits, so now we have how many? (7)

e. I add another bit and that has how many dots on it? (8)

f. Repeat until a pattern is recognised that the number on the next card to the left is one more than the total number of dots on all the cards to the right (e.g. there are 15 dots on the 8, 4, 2 and 1 cards, so the next card to the left is 16). This makes it easy to work out the number if all the bits are switched on - double the left-hand card, and subtract 1.

g. How many different numbers can I make with two bits? (4; often students will say 3 because they haven't counted 0)

h. Let's add the next bit; how many different numbers can we make now? (8, again 7 will often be given as an answer first)

i. Repeat until a pattern is recognised that each time we add another bit we can now represent twice as many numbers.

Teaching observations

A concept that students may struggle with here is that the number of values is one more than the maximum value (e.g. from 0 to 7, there are 8 different numbers). The same observation occurs with the number of digits in conventional decimal numbers; the largest digit is 9, but there are 10 possible digits (counting 0). This is sometimes called the fencepost problem (the number of fence posts is one more than the number of gaps between them), and it comes up a lot in computing.

Lesson Reflection

Would this activity work if we used white and cream cards? Why? Why not? (In principle you could use these, but it wouldn't be a good idea. We are looking for the answer that they are not contrasting colours, therefore it would be difficult to see if it is actually on or off. This hints why computers use easily distinguished physical representations.)

What are some contrasting symbols or ways that we can show on and off in binary?

(Ideas could include holding the cards up high, or down low; simply holding up a hand; sitting down or standing up; or using a different representation such as lights that are on or off.)

Computers are cheaper and easier to build if they represent data with just two contrasting values, which we represent as the numbers 0 and 1. What else could we use to represent two opposites in writing? (Perhaps a cross or tick; happy or sad face; or any other pair of symbols.)

Extending this idea, the numbers might be represented by a voltage that is either close to 5 volts, or close to 0 volts. The circuitry is built so that anything less than about 2.5 volts counts as 0 and anything over 2.5 volts counts as 1. Like the contrasting colours of the cards, this is very easy to recognise. We could have had 10 colours of cards to represent the digits from 0 to 10, and we could have ten voltage ranges (0 to 0.5, 0.5 to 1.0 and so on), but it's way more complicated to build fast and accurate circuitry for this.

Throughout the lessons there are links to computational thinking. Below we've noted some general links that apply to this content.

Teaching computational thinking through CSUnplugged activities supports students to learn how to describe a problem, identify what are the important details they need to solve this problem, break it down into small logical steps so that they can then create a process which solves the problem, and then evaluate this process. These skills are transferable to any other curriculum area, but are particularly relevant to developing digital systems and solving problems using the capabilities of computers.

These Computational Thinking concepts are all connected to each other and support each other, but it's important to note that not all aspects of Computational Thinking happen in every unit or lesson. We've highlighted the important connections for you to observe your students in action. For more background information on what our definition of Computational Thinking is see our notes about computational thinking.

Algorithmic thinking

We used an algorithm in this lesson to convert a decimal number to a binary one. This is an algorithm because it is a step-by-step process that will always give the right solution for any input you give it as long as the process is followed exactly.

Here's an algorithm for working out which dot cards should be showing, written in text:

Find out the number of dots that is to be displayed. (We'll refer to this as the "number of dots remaining", which initially is the total number to be displayed.)

For each card, from the left to the right (i.e. 16, 8, 4, 2 then 1):

If the number of dots on the card is more than the number of dots remaining:

Otherwise:

Show the card

Subtract the number of dots on the card from the number of dots remaining

Note that this algorithm (working from right to left) works very well with the cards, but if you look up computer programs for doing this, you may encounter a different one that works from right to left. It's usual to have multiple algorithms that achieve the same thing.

Examples of what you could look for:

Which students are methodical when they convert between decimal and binary? Which ones start with the leftmost card and move one card at a time to the right, rather than choosing cards at random and flipping them on and off until they get the right number?

Abstraction

Binary number representation (just using 0 and 1) is an abstraction that hides the complexity of the electronics and hardware inside a computer that store data. Abstraction helps us simplify things because we can ignore the details we don't currently need to know.

In this case the details we can ignore include: Computers use physical devices like electronic circuits and voltages in circuits to store and move data, and there are many complex physics and mathematical theories that make this work.

We don't need to understand how these circuits work to use data and represent things using binary. Using binary is an Abstraction of these circuits and allows us to represent numbers as being made out of bits (0s and 1s), to understand data and work out problems without having to think about what is happening 'underneath the hood' of the computer.

Another use of abstraction is considering what is needed to represent any given digit in binary. The answer is all you need are two different things. These things can be anything! Two different colours, two different animals, two different symbols etc. As long as there are two of them, and they are different, you can use these to represent any number, using binary, the same way a computer uses electricity to represent data.

We can use binary digits to represent any type of data stored on a computer. When we represent other forms of data (such as letters, images, and sound) we also use abstraction because we hide the details of all the binary numbers underneath and just look at the whole piece of data. All forms of data end up being represented as numbers (which in turn are really just combinations of bits) - for text we have a number for each letter, for images we use a number for each colour, and so on. We are using multiple layers of abstraction! For example, a familiar form of abstraction is that the month "October" could be represented by the number ten, which in turn is represented by the bits 01010, and if these are stored as voltages in computer memory, it is ultimately "low, high, low, high, low" for the voltages.

Examples of what you could look for:

Who are the students that demonstrate converting and representing binary numbers using things other than "1's and 0's", "black and white", and "off and on" (for example using :) and :(, or using people standing up or sitting down). If you are able to interchange terms like "black" and "white" with 0 and 1 without students being concerned about the difference, they are exercising abstraction.

Decomposition

An example of decomposition is breaking the conversion of the number to binary into one bit at a time. The questions "Should this be 1 or 0" for each of the dot cards is decomposing the problem to a series of questions.

Examples of what you could look for:

Which students recognise that it is important to start with the leftmost card and only consider one bit at a time? Which students focus on each individual bit at a time, rather than being overwhelmed by trying to work them all out in one go?

Generalising and patterns

Recognising patterns in the way the binary number system works helps give us a deeper understanding of the concepts involved, and assists us in generalising these concepts and patterns so that we can apply them to other problems.

At a simple level, we started with the numbers 1, 2, and 4, and students generalised that to doubling values. The exercise used 5-bit numbers, but students should be able to generalise that to 8-bit numbers, or larger.

The algorithm for converting a decimal number to a binary one follows a pattern that can be generalised to solve the problem of giving change when someone pays by cash. For binary numbers you start with the largest bit always turn a bit on if you need it, just like when you're giving change you start with the largest denomination and then always take a coin (or note) whenever you need it. Jargon note: This is called a greedy algorithm - it takes as much as it can each time!

Mathematical links

Ask students what is special about the decimal to binary conversion, in contrast with the general change giving algorithm, and have them observe that in the general case you may need to give more than one coin of the same denomination, whereas in the binary conversion there is always one (or none) of each.

When counting upwards in binary, there is a pattern for how often particular cards flip. The 1st bit (with 1 dot) turns over every time, the 2nd (with 2 dots) turns for every second number, the 3rd (with 4 dots) turns for every 4th... Is there a pattern like this when we count in decimal numbers?

If you have 5 of the cards and all are visible, you will have the number 31, which is 1 less than the value of the next card, 32. Is this pattern always true?

The amount of numbers you can represent with a certain number of bits is the same as the value of the next bit that can be added. For example, using 4 cards (1, 2, 4, 8) you can represent 16 different numbers (0-15), and the next card in the sequence is the number 16. Each time we add the next card we also double the amount of different numbers we can represent.

Working with these patterns is valuable for working out the relationship between the number of bits being used and the power of what they can represent.

Explain one or more of the following patterns:

That with a certain number of cards you can make the same amount of different numbers as the number of dots that would be on the next card to be added on the left (remember that 0 is a number).

When you are counting upwards: the first card (1 dot) turns over every time, the second card (2 dots) turns every two times, the third (4 dots), every four times, and the fourth (8 dots), every eight times...

That when all the cards you have are visible it will add up to the next binary card number minus 1.

Examples of what you could look for:

Which students recognised quickly that each card was doubling the number of dots? Can students see the similarities between this and multiplying place values by 10 when they are using the decimal system?

Which students easily understand the patterns of cards flipping when counting with binary numbers?

Logic

Logical thinking means using rules you already know and using logic to deduce more rules and information from these. Once we know what number each of the binary cards represents then we can use this knowledge to figure out how to represent other numbers with the cards. If you memorise how to represent the numbers we can make with 5 cards, does that mean you understand how to represent any number with any number of bits? It doesn't, but you can understand how to do that if you understand the logic behind how these numbers with the 5 cards are made.

A good example of logical thinking in binary numbers is the reasoning for why each bit "has to" have a particular value (e.g. it has to be 1, or it has to be 0) to represent a given number. This in turn leads to understanding that there is only one representation for each number.

Examples of what you could look for:

Do students explicitly explain that the right-most bit needs to be a one because it is the only odd number and therefore is needed so that we are able to make any, and all, odd numbers? Without it we could only make even numbers.

Are students able to explain that each card "has to" be up the way it is for a given number e.g. the 16-dot card is needed for the number 19 because without it you only have 15 dots remaining to its right (not enough); but the 16 card isn't needed for the number 9 because it would give too many dots?

Evaluation

An example of evaluation is working out how many different values can be represented by a given number of bits (e.g. 5 bits can represent 32 different values), and vice versa (to represent 1000 different values, you need at least 10 bits).

Examples of what you could look for:

Can a student work out the range possible with 4 bits? (16)

6 bits? (64)

8 bits? (256)

If we add one more bit to a representation, how much does that increase the range? (it doubles it)

If we add two more bits to a representation, how much does that increase the range? (it is four times as much)

How many bits do we need to represent 1000 different values? (10 is sufficient)

# data[].attributes.attachment_link.description
Learning outcomes Students will be able to: What different number systems do we know about? (Answers might include: Roman Numerals; Tally marks; Number bases like binary, octal and hexadecimal; Language based systems like Chinese or Ancient Egyptian.) Why do we normally use 10 digits?