DR TEACH TECH • INTERACTIVE CS
Bit Harbor
Learn how computers count, one bit at a time.
LEVEL 1 • WHY BINARY?
Computers only need two states.
A bit can be off or on. We write those two states as 0 and 1. Binary place values grow using powers of 2.
Binary places grow 1, 2, 4, 8, 16, 32...
Binary Basics Practice 0/5
The decimal number 13
8 + 4 + 1 = 13
LEVEL 2 • BUILD A NUMBER
Bit Flip Board
Click a bit to turn its place value on or off. Complete five randomly selected targets to finish this activity.
Challenge 0/5
Build decimal 19 in binary.
LEVEL 3 • COUNTING, LIMITS, AND ERRORS
Binary Odometer
Why study a binary odometer?
An odometer makes a computer's limits visible. A fixed number of bits can represent only a fixed set of patterns. With 8 bits, there are 256 patterns, but the largest unsigned value is 255 because zero is one of the values.
11111111 = 255
256 total patterns because the count includes zero.
What does out of bounds mean?
Software often expects data to stay inside an allowed range. When a value goes outside that range, the result depends on the language and system. It may report an error, stop, wrap around, clamp the value, or continue with incorrect data.
Overflow means a numeric result is too large for the representation. Underflow can mean a value is too small to represent, especially for floating-point values. Index out of bounds means code requested a list or array position that does not exist. Range or conversion errors occur when a value cannot fit into the destination type.
Real-world examples
Four Important Types of Programming Errors
When programmers talk about an error, they do not always mean the same thing. It helps to separate errors into three common categories.
Syntax Error
A syntax error happens when code does not follow the rules of the programming language. The program usually cannot start until the mistake is fixed.
Example: missing a parenthesis, brace, quotation mark, or semicolon.
Runtime Error
A runtime error happens after the program starts running. Something occurs that the program cannot safely complete.
Example: trying to use an array position that does not exist, dividing by zero in some languages, or converting a value that is outside the allowed range.
Logic Error
A logic error means the program runs, but the result is wrong because the instructions or assumptions are incorrect.
Example: using the wrong formula, checking the wrong condition, or interpreting data using the wrong units.
Overflow Error
An overflow error happens when a number becomes too large, or sometimes too small, to fit in the number of bits or data type available.
Example: an unsigned 8-bit value can store 0 through 255. Trying to go one higher than 255 exceeds that range.
- Overflow error happens when a value does not fit in the available range. Some systems stop with a runtime error, while others wrap or truncate the value, which can create a logic error if the program does not handle it correctly.
- Index out of bounds is usually a runtime error because the program tries to access a position outside the valid range.
- Range or conversion errors can be runtime errors when a value cannot fit in the destination type.
- Incorrect units or assumptions are often logic errors because the program may run normally while producing the wrong result.
Patriot system, 1991
A small timing precision error accumulated after many hours of operation and affected tracking of an incoming Scud missile. This was a precision problem, not a simple 8-bit overflow, but it shows how small representation errors can become serious.
Ariane 5 Flight 501, 1996
A 64-bit floating-point value was converted to a 16-bit signed integer. The value was too large to fit, causing an exception that contributed to loss of guidance.
Mars Climate Orbiter, 1999
One part of the mission used English units while another expected metric units. This was not overflow, but it shows how computers can process numbers correctly while humans disagree about their meaning.
Historical examples summarized from U.S. GAO, ESA, and NASA/JPL investigations.
Now use the odometer to see a representational limit yourself. Trigger rollover and complete five randomly selected questions.
Base 10 Odometer
Binary Odometer
Watch the Odometer
Press Start. In 8-bit mode the odometer begins at 0 and counts upward: 0, 1, 2, 3... Watch how the same value is represented in Base 10 and Binary.
Odometer Practice 0/5
LEVEL 5 • THE BITS NEED MEANING
Context Matters
The same bits can mean different things
Binary stores patterns of 0s and 1s. A bit pattern does not contain a built-in label saying, “I am a positive number,” “I am a negative number,” “I am text,” or “I am a color.” Software needs rules that explain how the bits should be interpreted.
Those rules can come from a data type, CPU instruction, file format, database field, or protocol. Sometimes metadata is stored with the data. Other times the program already knows the expected format. Bits plus context create meaning.
Signed and unsigned integers
An unsigned 8-bit integer uses all eight bit positions for values from 0 through 255.
A common signed representation is two's complement. With 8 bits, the leftmost position has a weight of -128. The remaining weights are 64, 32, 16, 8, 4, 2, and 1.
11111111 signed 8-bit two's complement = -1
A leftmost bit of 0 means a two's-complement value is nonnegative. A leftmost bit of 1 means it is negative. The leftmost bit participates in the value. It is not simply a separate “negative switch.”
Try one bit pattern
Does the computer need extra binary data every time?
Not always. Sometimes metadata identifies a format. Often the context comes from software itself. A variable's data type, a file format, or an instruction tells the computer how to interpret stored bits.
Stored data does not explain itself. The meaning comes from an agreed encoding or interpretation.
Context Practice 0/5
LEVEL 6 • BINARY REPRESENTS MANY KINDS OF DATA
Binary in Media
The same 0s and 1s can represent very different information when different encoding rules are used. Complete all three activities.
1. Text with ASCII
ASCII is a code that assigns a number to each character. You are not expected to memorize the table. Use the reference below just like a programmer would use documentation.
Use the reference to decode this byte into a capital letter:
| Character | Decimal | 8-bit Binary |
|---|---|---|
| A | 65 | 01000001 |
| B | 66 | 01000010 |
| C | 67 | 01000011 |
| D | 68 | 01000100 |
| E | 69 | 01000101 |
| F | 70 | 01000110 |
| G | 71 | 01000111 |
| H | 72 | 01001000 |
| I | 73 | 01001001 |
| J | 74 | 01001010 |
| K | 75 | 01001011 |
| L | 76 | 01001100 |
| M | 77 | 01001101 |
| N | 78 | 01001110 |
| O | 79 | 01001111 |
| P | 80 | 01010000 |
| Q | 81 | 01010001 |
| R | 82 | 01010010 |
| S | 83 | 01010011 |
| T | 84 | 01010100 |
| U | 85 | 01010101 |
| V | 86 | 01010110 |
| W | 87 | 01010111 |
| X | 88 | 01011000 |
| Y | 89 | 01011001 |
| Z | 90 | 01011010 |
Real ASCII includes many more characters. This shortened table keeps the activity focused on uppercase letters.
2. Music as Beats
Digital audio is often sampled as numbers. For this simpler activity, use a beat encoding: 1 = sound, 0 = rest.
Build this eight-beat pattern: 10110010.
Press Play Pattern to hear the current 8-beat sequence.
3. Images with Pixels
A simple black-and-white image can use one bit per pixel. Here, 0 = white and 1 = black.
Match: 1010 0101 1010 0101
RGB color uses separate numeric values for red, green, and blue.
Each 8-bit RGB channel has 256 possible values, from 0 through 255. The same channel can be written in decimal, binary, or hexadecimal.
Student Progress Record
LEVEL 4 • ORIGINAL GAME
Packet Harbor
Before the Game: What Is a Packet?
When computers communicate, they often break information into smaller pieces called packets. Think of a packet as a small digital envelope carrying part of some information.
Packets travel between devices and need addressing information so the network knows where they should go. You do not need to know networking yet for this activity.
Packet Harbor uses a simplified pretend network. Each dock is a destination. Each dock has a decimal number, and that same number can also be written in binary.
Your job is only to practice binary conversion. The packet theme gives the numbers a purpose, but these dock addresses are not real Internet addresses.
Complete five randomly selected Packet Harbor problems. Some ask you to build a binary address. Others ask you to decode binary into decimal.
Current value: 0
Start with the largest place value that fits.
Student Progress Record
Completion requires all four activities. Active time counts while this tab is visible.