Text, pictures, sound and the program itself — all one kind of thing, written with two digits. Flip eight switches, watch letters turn into numbers, and meet the reason 0.1 plus 0.2 is not 0.3.
A computer stores exactly one kind of thing: numbers. Text is numbers, colours are numbers, sound is numbers, your photos are numbers, and the program itself is numbers. The only question is what the numbers are agreed to mean.
And underneath even that, the numbers are written with only two digits, 0 and 1, because a wire is either carrying current or it is not. Two states is the one thing electronics can be reliably sure about. Everything is built on that.
A single 0-or-1 is a bit. Eight of them together is a byte. That is not trivia — it is the reason for a pile of things that will otherwise look arbitrary in C++, including why a whole number has a maximum size and why it goes strange when you pass it.
Eight switches. Each one is worth double the one to its right. Turn some on and read the total — that is genuinely all binary is.
Click the switches. Try to make 1, then 7, then 255.
Eight switches, all on, is 255 — the biggest number a single byte can hold. That is why so many limits in computing are 255, or 65,535, or 4,294,967,295. They are not chosen. They are just what you get when you run out of switches. In C++ this becomes real: a value that goes past its maximum does not error, it silently wraps around to the bottom.
If the machine only holds numbers, a letter has to be a number too. So everyone agreed on a table: 65 means A, 66 means B, 97 means a. That is the whole trick — there is nothing letter-like about the number 65.
Every character you type is stored as the number underneath it.
Try typing a capital A and then a lowercase a. They differ by exactly 32 — and that is not a coincidence, it is one bit. In C++ you will meet char, which is a small number wearing a letter's clothes, and you will be able to add to it.
Here is a genuinely famous one, and it is not a bug. Ask any computer to add nought point one and nought point two:
This is running in your browser, live, on this page.
The reason is the switches. In our ten-fingered notation, a third has no exact form — 0.333… goes on forever and you have to stop somewhere. In a two-state machine, a tenth is that same kind of number. It cannot be written exactly with any number of switches, so it is stored very slightly wrong, and the error shows up when you add.
Never check whether two decimal numbers are exactly equal. Ask whether they are close enough. This will cost somebody in your class an entire evening this semester, because their answer was right and the comparison said no. And never store money as a decimal — store whole pennies.
Count out loud from 1 upward, raising fingers as binary switches — thumb is 1, index is 2, middle is 4, ring is 8, little is 16.
Call out the total each time and catch the mistakes. Then say a number under 31 and make A show it.
One hand reaches 31, not 5. Two hands reach 1,023. That jump — five switches giving thirty-one, ten giving a thousand — is the same doubling that made halving so powerful in level six. Same idea, met from the other end.
Text, pictures, sound, and your program itself. The meaning comes from what everyone agreed.
255 and 65,535 are not decisions. They are what running out of bits looks like.
Compare them for closeness, never for exact equality. Keep money in whole pennies.
Not recall — these are the shapes an exam actually uses. Every answer below was produced by compiling and running the code, so if you disagree with one, the compiler is the one to believe.
Have a real go before revealing. Being wrong here is worth more than being right in three weeks.
Eight switches, worth 128, 64, 32, 16, 8, 4, 2, 1 from left to right. The pattern is 01000001. What number is it?
All eight switches on. What is the biggest number you can make?
Is 0.1 + 0.2 exactly equal to 0.3 in a computer?
← back to all 12 levels · stuck on anything? ask peter.