Chapter 01 of 22 Part I: Digital Foundations

Magic or Mathematics?

Each project below is tailored to a specific algorithm and scientific question from Chapter 01, with concrete inputs, verifiable numerical outputs, boundary cases, and links to the related lab and pioneer.

Project 1 of 3 · v1-c01-p01 Foundational · ~20 min

Binary Mind-Reader Card Engine

Lab activity: A · Mind reader · Related code: block-01.js, block-04.js · Pioneer: View profile

Real-World Problem: How can a computer identify one item out of 64 possibilities using only six yes-or-no electrical switches?
Scientific Question: Why does each binary question exactly halve the remaining search space?

Objective: Encode integers 1–63 into 6-bit binary arrays and reconstruct any secret number from six yes/no card answers.

Hypothesis to Test: If a secret number appears on cards 1, 4, and 16, adding their leading powers of two will always reconstruct the exact number.

Step-by-Step Implementation

  1. Generate the 6 binary cards by grouping integers 1–63 where bit k (2^k) equals 1.
  2. Collect six boolean answers from a partner in Activity A of the Chapter 01 Lab.
  3. Sum 2^k for each "Yes" answer using bitwise shift (1 << k) in JavaScript.
  4. Verify boundary numbers 0 (all No), 1 (only bit 0), and 63 (all Yes).
Concrete Input: Answers: [Yes (1), No (2), Yes (4), No (8), Yes (16), No (32)]
Expected Output: Reconstructed secret number = 1 + 4 + 16 = 21 (binary 010101).

Test Cases: Input [1,0,1,0,1,0] -> 21; Input [1,1,1,1,1,1] -> 63; Input [0,0,0,0,0,0] -> 0.

Boundary Condition: Numbers >= 64 overflow 6 bits and require a 7th bit (2^6 = 64).

Common Mistake to Avoid: Confusing bit 0 (value 1) with bit 1 (value 2) and off-by-one array indexing.

Interpreting Results: Every binary digit doubles representational capacity: n bits encode 2^n states.

Show Hint, Extension Challenge & Reflection

Hint: Review the worked example and equation in Chapter 01 before testing the boundary case: Numbers >= 64 overflow 6 bits and require a 7th bit (2^6 = 64).

Extension Challenge: Extend the card generator to 7 bits (1–127) and verify how many numbers appear on each card (64).

Reflection Question: Why does binary work better for noisy electronic switches than base-10 voltage levels?

Project 2 of 3 · v1-c01-p02 Foundational · ~25 min

2D Parity Card-Flip Detective

Lab activity: B · Card detective · Related code: block-02.js · Pioneer: View profile

Real-World Problem: Memory chips and radio packets suffer occasional single-bit flips from electrical noise.
Scientific Question: How does adding one parity bit per row and per column locate the exact flipped cell?

Objective: Build a 5×5 binary grid with row/column even-parity guards and automatically identify any single flipped bit.

Hypothesis to Test: Flipping cell (r, c) will cause exactly row r and column c to report odd parity.

Step-by-Step Implementation

  1. Initialize a 4×4 data matrix of 0s and 1s and compute even parity for each row and column.
  2. Compute the corner guard bit so both the bottom row and right column have even parity.
  3. Flip one arbitrary bit and scan row and column XOR totals to find the unique odd intersection.
  4. Flip two bits in the same row and observe why row parity passes while two columns fail.
Concrete Input: 4×4 data grid with even parity border; flip cell at row 2, column 3.
Expected Output: Odd row = 2, Odd column = 3 -> Corrupted bit located at (2, 3) and repaired.

Test Cases: 0 flips -> Valid; 1 flip at (1,2) -> Detects (1,2); 2 flips in row 1 -> Row parity stays even.

Boundary Condition: Two flips in the same row and two in the same column forming a rectangle can evade 2D parity entirely.

Common Mistake to Avoid: Forgetting to update the corner parity bit when changing initial data.

Interpreting Results: Redundancy turns silent corruption into detectable or correctable geometry, with well-defined limits.

Show Hint, Extension Challenge & Reflection

Hint: Review the worked example and equation in Chapter 01 before testing the boundary case: Two flips in the same row and two in the same column forming a rectangle can evade 2D parity entirely.

Extension Challenge: Write a detector that distinguishes 0 errors, 1 correctable error, and 2+ uncorrectable errors.

Reflection Question: Why is knowing when an error-checker can fail just as important as knowing when it succeeds?

Project 3 of 3 · v1-c01-p03 Intermediate · ~25 min

Mars Telemetry Parity Stress Test

Lab activity: C · Message from Mars · Related code: block-03.js, block-04.js · Pioneer: View profile

Real-World Problem: Deep-space probes transmit weak signals across millions of kilometers where radiation flips bits.
Scientific Question: At what error rate does a single-bit parity check begin passing corrupted packets?

Objective: Simulate noisy transmission of 8-bit telemetry frames and measure undetected double-bit errors.

Hypothesis to Test: Any frame receiving an even number of bit flips (2, 4, 6) will falsely pass a single even-parity check.

Step-by-Step Implementation

  1. Append an even-parity bit to a 7-bit Mars temperature reading using XOR reduction.
  2. Simulate 1-bit noise bursts and record the receiver detection rate.
  3. Inject 2-bit noise bursts and confirm the receiver falsely accepts the corrupted temperature.
  4. Compare overhead (1 extra bit per 7 data bits = 12.5%) against detection coverage.
Concrete Input: 7-bit payload 1011010 + even parity bit 0; inject 1 flip vs. 2 flips.
Expected Output: 1 flip -> 100% detected; 2 flips -> 0% detected (false negative).

Test Cases: Payload 1011010 -> parity 0; flip bit 2 -> detected; flip bits 2 and 5 -> undetected.

Boundary Condition: Zero-length payloads have trivial parity 0; all-ones 7-bit payload requires parity 1.

Common Mistake to Avoid: Assuming "parity valid" means "data guaranteed uncorrupted".

Interpreting Results: Single parity detects odd error counts only, motivating Hamming and Reed-Solomon codes in Chapters 4–5.

Show Hint, Extension Challenge & Reflection

Hint: Review the worked example and equation in Chapter 01 before testing the boundary case: Zero-length payloads have trivial parity 0; all-ones 7-bit payload requires parity 1.

Extension Challenge: Run 1,000 random trials with 10% per-bit flip probability and compute the empirical false-pass rate.

Reflection Question: What real-world consequences occur when a spacecraft or medical device relies on insufficient error detection?