PROGRESS 0/7 ▾
phillycomputerscience.com — AP CSP

The Bit Switchboard

Assign meaning to patterns of bits, then flip the problem around and turn those patterns into numbers.

Just Two States → Bits → Bases

01 · ENCODE not yet

How Many Bits Do We Need?

Say you want to store a list of things — dog breeds, groceries, directions a character can move. Pick a category, then drag the bit slider and watch how many things that many bits can hold. Find the smallest number of bits that fits your whole list, then it's your job to decide what each pattern means. Complete all 5 categories to finish this section.

3 bits → 8 things —

02 · COMPARE not yet

Hash Marks vs. Binary

Here are 8 switches — think of them as 8 hash marks. If you just count how many are flipped on, that's one way to use them. Reading the exact same switches as place values is a completely different, far more powerful way to use them.

Tally reading — just count the ON marks

0
Order never matters here. With 8 marks, the count can only ever land somewhere between 0 and 8.

Binary reading — count the place values

0
00000000
8 hash marks tallied: 9 possible totals (0–8). The same 8 bits read positionally: 256 possible values (0–255) — about 28× more, from the exact same physical switches.

03 · CONVERT not yet

Bit Playground

You just saw place value beat a plain tally — now play with it directly. Every switch is a bit — fully on, or fully off, nothing in between. Set how many bits you have, then flip switches and watch the decimal value update.

Binary value
00000000
Decimal value
0
0
Values this many bits can represent
256
2⁸ = 256 possible values (0–255)

04 · SCALE not yet

Powers of Two

That efficiency comes from place value, and place value scales in a very specific way: every single bit you add doubles the number of things you can represent.

2
This is the starting point: 1 bit = 2 values.

Each little box is one representable value. Click +1 bit and watch it double, every single time — all the way up to 32 bits.

05 · APPLY not yet

Powers of Two in Your Pocket

Phone and computer storage only ever comes in specific sizes — 64GB, 128GB, 256GB — because memory chips are built on the exact doubling pattern you just explored. But "GB" doesn't always mean the same number of bytes, which is why a 128GB phone never quite shows 128GB of free space.

128 GB 2⁷ = 128GB — the next size up is just one more address line: one more bit.

Same prefix, two different numbers

Why your phone "loses" storage

Advertised — decimal, ×1000
128 GB
128,000,000,000 bytes
What Settings actually shows — binary, ×1024
119.2 GB
128,000,000,000 ÷ 1,073,741,824
Storage makers use "GB" the same way scientists use "kilo" everywhere else — 1000-based, the same convention behind kilograms and kilometers. Your phone's operating system counts free space the way memory actually works underneath: in powers of two. Same word, two different numbers — and the gap grows as the drive gets bigger, which is why a "1TB" phone shows up as roughly 931GB.

The cost of memory

While storage capacity has been doubling, the price of each gigabyte has been doing the opposite — cut roughly in half every year or two, for decades. That's the same exponential curve from module 04, just running downhill.

1980: ~$100,000/GB 1990: ~$10,000/GB 2000: ~$10/GB 2010: ~10¢/GB 2020: ~2¢/GB today: ~1–2¢/GB
So why does doubling your phone's storage at checkout — say from 256GB to 512GB — still add roughly $100 to $200 to the price, when 256GB of raw flash memory costs the manufacturer somewhere in the ballpark of $15–$25? Mostly business, not physics: it's priced to nudge people toward the tier the company wants to sell, not to match the actual cost of the chips inside. The memory itself keeps getting absurdly cheap — the price tag on the box just doesn't always follow.

06 · PRACTICE not yet

Counting in Binary

Binary counting works exactly like decimal counting — when a place fills up, it rolls over and carries into the next place. Uses the bit count set in the Bit Playground above.

Binary
00000000
Decimal
0

Click +1 repeatedly and watch which bit flips each time. Notice how often the rightmost bit changes compared to the leftmost one.

Build this number: —
0 correct / 0 attempts

07 · INVESTIGATE not yet

Number Base Explorer

Base 10 has ten digits (0–9) because we happen to have ten fingers. Base 2 has two digits because a bit only has two states. Pick a decimal number and see how it looks written in other bases.

Base 2 (binary) place values

Base 10 (decimal) place values

DAY 2 · PRACTICE

Flippy-Do Practice: 8-Bit Conversions

Grab your paper flippy-do chart. Below is your own personal set of 24 conversions — half binary → decimal, half decimal → binary, nobody else in the room has the exact same set. Work through them with the chart, type in your answers, then check your work. Your answers are saved automatically, so it's safe to close the tab and come back later. Click "New Set" only if you want a fresh batch of numbers.

0 of 24 correct

DAY 3 · BUILD

Let's Build an ASCII Table

Bits can represent anything we assign them to — including letters. Let's invent a code for text from scratch, hit the problem with it ourselves, then see how the real ASCII standard actually solves it.

Stage 1 of 6

DAY 3 · SHIFT

Uppercase vs. Lowercase — One Bit Apart

Look at the codes you just uncovered: 'A' is 65, and 'a' is 97. Those aren't random — the difference is exactly 32, which in binary is 100000. Flip that single bit and a capital letter becomes lowercase.

A
Uppercase 65 = 01000001
Lowercase 97 = 01100001
Only the 6th bit from the left changes — worth 32, or 100000 in binary.

DAY 3 · SPELL

Spell It Out

Type anything — your name, a word, a short sentence — and watch it turn into ASCII, letter by letter.

DAY 3 · PRACTICE

Encode It By Hand

Here are your words. For every letter, write its 8-bit ASCII binary code — use the reference table below if you need it. Your answers save automatically.

0 of 0 correct

DAY 3 · EXPAND

Beyond ASCII: Unicode

ASCII works great — if you only ever write in English. It wasn't built to, and it shows. Here's how that problem got fixed.

1963

American and European engineers meet to standardize how computers represent text. They build ASCII around the alphabet they use every day: English. 128 codes cover every English letter, digit, and punctuation mark. Problem solved — or so it seems.

1970s

European languages need letters ASCII never planned for — é, ñ, ü, ç. Countries start inventing their own "extended" versions using the unused codes 128–255. But everyone's extension is different: a French computer and a German computer can't agree on what byte 200 means.

1980s

Computing explodes across Asia. Japanese, Chinese, and Korean writing systems use thousands of characters — Chinese alone has tens of thousands. A single byte (256 possible values) isn't even close to enough. Japan, China, and Korea each build their own multi-byte encoding systems, all incompatible with each other. Text files start arriving corrupted — garbled nonsense text, later nicknamed "mojibake" — whenever they cross between systems that don't agree on the code.

1991

An international group of companies and engineers proposes Unicode: one single standard, one number for every character in every writing system on Earth — plus math symbols, historic scripts, and eventually thousands of emoji. One code. No more mismatched translations.

ASCII has room for 128 characters. Unicode's codespace holds 1,114,112 possible code points (written U+0000 through U+10FFFF) — more than 150,000 of them are already assigned to real characters across over 160 writing systems, with plenty of room left to grow.

Try it: any language, any emoji

Same first 128 codes as ASCII, then the whole world

Unicode was built to include ASCII exactly as-is — code point U+0041 is capital 'A', just like ASCII's 65. Everything past that is new territory:

Going further: how do those big numbers become bytes?

A code point like U+1F600 (😀) is way too big to fit in one byte. UTF-8 — the encoding used on most of the web — solves this with a clever trick: the first few bits of the leading byte announce how many bytes the character takes, so a program can tell instantly where one character ends and the next begins.

DAY 4 · LEARN

Binary Bracelets

Everything you've been reading as switches and grids, you can wear. Two bead colors, eight beads, one letter — the exact same ASCII binary from Day 3, just strung on a string instead of drawn on a screen.

Pick two bead colors. One means 0, the other means 1. That's the whole code — everything else is just stringing 8 of them in the right order.

Example: the letter 'A'

'A' is 65 in ASCII, which is 01000001 in 8-bit binary. Read left to right, each digit becomes one bead:

How to actually make one

  1. Pick two colors of beads — one for 0, one for 1. Anything works, as long as the two colors are easy to tell apart.
  2. Pick a letter. Look up its ASCII code and write it out as 8 bits (use the Day 3 reference table if you need it).
  3. Cut a piece of elastic cord long enough for 8 beads plus some slack for tying.
  4. String your 8 beads on, left to right, matching the binary — first bit closest to the knot.
  5. Tie it off. That bracelet now spells one letter — as long as whoever's reading it knows which color means which bit.
  6. Want your whole name? Make one bracelet per letter and wear them together, or string them all on one longer cord with a spacer bead between letters.

DAY 4 · BUILD

Design Your Own

Pick your bead colors, type your name (or anything else), and see exactly which beads you'd need to string for every letter.

CERTIFICATE

Your Completion Certificate

Finish every section across all four days for full credit — but you can save a certificate at any point. It'll show exactly what's done and what's still open, no matter which day you're on.

0 of 14 sections complete.
The Bit Switchboard
AP CSP — Binary, Bits & Number Bases
Name: —
—
0 of 7 sections complete