Marble Computing: Counting

# Marble-Powered Computing: Counting

This online workshop will be looking at how to 'program' a marble computer to count out a specific number within the range of 0 to 15.

## What is a 'Marble-Powered Computer'?

A marble computer is a mechanical representation of what is happening inside a computer. Instead of electrons flowing through the circuits, you have marbles flowing through set pathways.

The marble computer used in the images and videos here, is built using a kit called 'Turing Tumble'

If you wish to experiment with this marble-powered computer set-up, but do not have access to the above kit, here is a basic online simulator

### Programming a Marble-Powered Computer

For this workshop we shall be using the below components:

#### Ramp

These control the directional flow of the marbles through the program.

#### Switch

This is a switch component in the 'off' position

#### Switch

This is a switch component in the 'on' position

#### Stop

The role of this is to capture a marble and stop the program

### The completed set-up

The below image show the completed set-up for this marble-powered computer program with all the switches in their 'off' position.

## Activity One: Switch Values

For the first run-through we shall leave all the switches in their 'off' position as illustrated in the set-up image above.

Will any marbles reach the output bar?

Watch the below video to see if you were right.

### What Does Each Switch Do?

Let us start by giving each switch a label:

#### Switch D

Now, we will look at what effect Switch D has on the program by moving it to the 'on' position.

How many marbles will reach the output bar now?

Watch the below video to see if you were right.

We now know what happens when Switch D is 'turned on'.

#### Switch C

Next, we shall reset the program and change it so only Switch C is in the 'on' position.

How many marbles will reach the output bar now?

Watch the below video to see if you were right.

#### Switch B

Let us run the program again, but this time, we shall only have Switch B in the 'on' position.

How many marbles will reach the output bar now?

Watch the below video to see if you were right.

#### Switch A

Yes, you guessed it, we will now repeat the program with only Switch A in the 'on' position.

How many marbles will reach the output bar now?

Watch the below video to see if you were right.

## Activity Two: Combining Values

We now know how many marbles each switch allows through.

So, how many marbles will be output if we start the program with all the switches at the 'on' position?

Watch the below video to see if you were right.

This shows us the maximum number of marbles that this system can output.

Using what we've seen so far, can you predict the output number of marbles if we set switches B and C to 'on', whilst A and D are 'off'?

Watch the below video to see if you were right.

How could we program the switches to output 7 marbles? Which switches will need to be 'on'?

Which switches would give of an output of 13?

Is it possible to program this system for any output value between 0 and 15?

## Binary

Computers store information in their memory. Today, this is measured most commonly in gigabytes. So, when you hear about a 32GB phone it tells you that the phone can store 32 gigabytes of information.

What is a gigabyte? A gigabyte is 1024 megabytes. A megabyte is 1024 kilobytes. A kilobyte is 1024 bytes. So, in total, a gigabyte = 1,073,741,824 bytes.

Ok, but what is a byte? A byte is made up of 8 bits. A bit is a single digit with the value of 0 or 1.

This means that all information in a computer's memory is stored in 1s and 0s. This system of counting in only ones and zeroes, is called binary.

That doesn't explain what any of this has to do with the marble-powered computer above...

First, let us look at the binary for the numbers of 0 to 15

Number Binary Number Binary
0 0000 8 1000
1 0001 9 1001
2 0010 10 1010
3 0011 11 1011
4 0100 12 1100
5 0101 13 1101
6 0110 14 1110
7 0111 15 1111

Now, let us look at our marble-powered computer. We had four switches which could be either 'on' or 'off'.

For example; to get an output of 11, we'd have to have switches A, C and D in the 'on' position, whist B was in the 'off' position.

Let us then write that in the order of ABCD. This would give us 'on''off''on''on'.

Instead of writing 'off' we can use 0, and instead of 'on' we can use 1

Now, in the order of ABCD, 'on''off''on''on', gives us 1011

Look at the above table and you will see that we have matched the binary value for 11.

Repeat this process for how we would have the switches set on the marble machine for each output value between 0 and 15. Do your results match with the table above?

### What does this mean?

It means, that our marble machine is a computer with a 4 bit (or 1/2 byte) memory

It also means, you have now learnt how to count in binary from 0 to 15