Book Zero: The Carmen Sandiego Algorithm
Book Zero Preview: Four chapters
Chapter 4 and beyond require Starter Access or higher.
The Correct Code Library

Book Zero

The Carmen Sandiego Algorithm

Cover

Correct Code Press

I hope you like IT.

Correct Code Press exists to publish works devoted to disciplined thought.

We believe reasoning is not a talent. It is a structure.

We believe correctness is not luck. It is preserved.

We believe elimination is stronger than guessing, and proof is stronger than confidence.

Every book under this imprint is written with a single obligation: to make thinking lawful.

Correct Code Press does not publish trends. It publishes systems.

Each work is designed to endure beyond tools, languages, and platforms because structure outlives syntax.

An imprint dedicated to reasoning in the age of automation.

Correct Code Press. All rights reserved.

Published by Correct Code Press
Written by Garonzick D. Hall

Foreword

Most people think they do not know algorithms until they see one in a textbook.

But many of us learned a real algorithm long before we learned to code: we learned it while chasing Carmen.

Where in the World Is Carmen Sandiego? is not a trivia game. It is a proof game. It teaches you to treat facts as constraints, to treat geography as a problem space, and to treat movement as lawful elimination.

This book is Book Zero: a short bridge between the world you already understand and the algorithmic discipline the other CCF books formalize.


Author's Note

I'm not using Carmen as nostalgia. I'm using it as a mirror.

Because the Carmen game reveals what most CS education hides: you can be correct without being clever, as long as you obey constraints and shrink the possibility space lawfully.

The Correct Code Framework (CCF) is the same discipline you used in the game, named, structured, and reusable.

Trademark note
Book Zero: The Carmen Sandiego Algorithm is an original Correct Code Framework learning asset. Any references to classic detective or geography-learning media are used only as cultural commentary or playful inspiration.

Before You Read

This is not a history of the franchise. It is not a guide to beating the game by memorizing locations.

Sequential Gate Rule
Read like a detective. As you move through the prompt, you will pass gates, moments where you have enough evidence to pause and ask, 'What kind of world am I in?' Don't stop reading at the first gate. Keep going. New clues can disqualify your early guess.

This is a book about reasoning: how to turn clues into constraints, constraints into elimination, and elimination into certainty.

If you read this correctly, you will notice a shift: you will stop thinking of algorithms as 'code tricks' and start seeing them as proof-driven movement.


Reader Contract

Same contract as the other books, just in a familiar disguise.

Who this book is not for
  • If you want shortcuts instead of certainty.
  • If you want 'pattern lists' instead of proof habits.
  • If you want clever guesses that work sometimes.
  • If you want to treat clues as vibes instead of constraints.

If you accept the contract, the payoff is simple: you'll recognize the same algorithmic discipline inside arrays, graphs, system design, and interviews because you've already done it once.


How to Use This Book

For each chapter, do the same three moves:

  1. Name the problem space (what universe are we searching?).
  2. Extract constraints (what becomes illegal?).
  3. Watch the space shrink (how elimination becomes certainty).
Non-negotiable rule
Never 'guess' when you can eliminate.

Table of Contents

Continue the Investigation

Chapter 4 and beyond require Starter Access or higher.


This book is dedicated to my A team.

Ace Malik Hall
(Favorite Gamer)
Amya & Alyssa
(Partners in Crimes)
Alani & Andrea
(My God Daughters)
You Are My Angels
My Beautiful Skies

I love you more than any book I could ever write.

This book is about a game that I loved playing as a kid.

Where in the World Is Carmen Sandiego?

I didn't get to play it as much as I wanted.

But the memories stuck with me.

Because it taught me how to think deeper.

Answers are not guessed.

They are eliminated.

This book is the beginning of something larger.

May it give you structure.

May it give you discipline.

May it give you freedom.

Everything I build is for you.

Kiss your mother and tell her thank you
for bringing such a wonderful life into my world.

I've given away books.

I've given away games.

Giving is my love language.

I give you these words.

In life and in code, you will make mistakes.

Speak to God about it.

He will correct you.

That correction may feel like discipline.

IT is love.

This IS my gift to you.

I hope you like IT.


Part I - The Detective Contract

Chapter Zero: WHAT IS AN ALGORITHM?

This chapter begins with a delay at a bank and ends with a failure at The Company's busiest dock.

Between those two events is a lesson about how systems think - and how naive thinking quietly destroys organizations.


10:00 AM - THE BANK

Two lines. On the left: consumer banking. Long. Restless. Audible sighs. On the right: business banking. Short. Silent. Moving.

A security guard stood between them like a boundary layer.

Ron Snow checked the time.

10:00 AM.

His daughter tugged his sleeve.

'Daddy, why is that line moving so slow and the other one moving fast?'

His face lit up.

'Different algorithms.'

'What's an algorithm?'

He picked her up so they were eye to eye.

'It's a routine. A way of doing the same thing over and over again until you find what you're looking for.'

He pointed.

THE SLOW TELLER - ENUMERATION (O(n))

She takes the customer's money: $120 (all $1 bills).

Counts each dollar one by one.

Recounts when distracted.

Corrects small mistakes.

Prints the receipt and gives it to the customer with the total deposit amount.

3 minutes.

THE FAST TELLER - INFERENCE (O(1))

She takes the next customer's money: $5,000 (all $1 bills).

Places the entire stack on a calibrated scale.

The scale already knows the weight of a single bill.

The total appears instantly.

Prints the receipt and gives it to the customer with the total deposit amount.

5 seconds.

'That teller is counting,' Ron Snow said.

'The other one is measuring.'

'But they're doing the same job.'

'Same job. Different approach.'

A man in line laughed.

'So she's just bad at her job?'

'She's working harder than everyone in the other line combined. She just wasn't taught a better way.'

His daughter frowned.

'So counting is dumb?'

'No. Counting is slow because you have to count every bill to get to the total. That's not dumb; it's naive.'

The security guard nodded.

'That explains a lot.'

Ron Snow checks the time again. He will be late for work.


9:00 AM - THE COMPANY (EARLIER)

The Company was already red before the day even started.

Junior came in first. Always does. Panic is punctual.

'Dock A is backing up again.'

The dashboard confirmed it:

Dock A wasn't just slow.

It was infecting the rest of the object.

Because that's what The Company is.

An object.

With state.
With behavior.
With boundaries.
With processes.

And one of those processes was broken.

10:30 AM - DISCOVERY

Ron Snow walked in.

Late.

I glanced at the clock. He noticed. He always notices.

'You're late.'

'Algorithm issue,' he said.

He wasn't wrong.

I let it go.

If he fixes it, I look good.
If he fails, it falls on me.

'Dock A is choking us,' I said.
'ABC is escalating. Staff is burning out.'

He didn't respond emotionally.

'Show me the process.'

Junior pulled up the workflow.

THE PROBLEM

Dock A unloads pallets for ABC Company.

Each pallet contains:

The dock currently verifies by scanning every box individually.

Constraint:
Only one verification pass is allowed before release.

Goal:
Determine how many boxes actually arrived.

DOCK A - THE NAIVE ALGORITHM (O(n))

Process:

~30 seconds per box
~50 minutes per pallet

Every box must be touched to confirm the total.

Touch everything to know anything.

Truck lines grow.
Morale drops.
Fuel burns.
Calls escalate.

The Company's state mutates.

DOCK B - THE MEASURED ALGORITHM (O(1))

Alternative process:

Inference:

5,000 / 50 = 100 boxes.

One operation.
Same truth.

'You didn't change the work,' Ron Snow said.
'You changed how the truth is extracted.'

That line stayed with me.

RESULTS

By 11:19 AM:

It wasn't a staffing issue.

It was an algorithm issue.

The Company had been running a naive process.

And naive processes don't just slow systems.

They create opportunities.

7:52 PM - NIGHT

The scale went offline.

'Maintenance issue.'

Manual verification reinstated.

Throughput dropped.

Overtime resumed.

ABC was quietly offered priority handling, for a fee.

No intrusion.

No breach.

No code changed.

The Crew, LLC did not attack the system.

They reverted it.

They restored the naive algorithm.

Fragile systems do not need to be broken.

They only need to be returned to default.

TECHNICAL ANALYSIS - ENUMERATION VS INFERENCE

Definition

Naive Algorithm (O(n)):
Work scales linearly with input size.

Measured Algorithm (O(1)):
Work remains constant regardless of input size.

In Dock A:
100 boxes ? 100 operations.

In Dock B:
100 boxes ? 1 operation.

Big O Doctrine

Ron Snow
'Big O doesn't measure how fast your computer is. It measures how fast your mistakes grow.'

Measurement collapses what counting expands.

Chapter Law

The method a system uses to arrive at truth determines:

The Company is an object.

Its processes are algorithms.

If the algorithms are naive, the object becomes fragile.

Chapter 1 - The Game Is a Proof Engine

You win by shrinking possibility, not by searching everywhere.

The Game Is a Proof Engine

1.1 What You Are Actually Doing

The game gives you a world (cities, countries, suspects) and asks you to locate one hidden truth. That is an answer space: a set of possible answers large enough to overwhelm guessing, but small enough to collapse under constraints.

Your job is not to 'try places.' Your job is to make places illegal to eliminate regions of the world until only one region remains feasible.

This is why the best players do not feel frantic. They feel steady. They are not searching for a lucky hit; they are executing a narrowing process that makes the answer inevitable.

1.2 The Three Hidden Worlds

Even in its simplest form, Carmen gives you three separate problem worlds at once:

A 'good move' is not a vibe. It is a move that shrinks one or more of these worlds while keeping the real answer inside the remaining space.

1.3 Why This Is Algorithmic

An algorithm is a finite, rule-bound process that preserves an invariant and ends with a proof of success (or impossibility). Carmen quietly hands you the full setup:

That is the core contract of correctness. The game is not 'about geography.' It is about running a proof loop on top of a familiar surface.

1.4 Clues Are Not Facts - They Are Knives

A raw fact is harmless. A clue becomes powerful only when it cuts the world.

'Speaks French' is not trivia. It is a boundary. The moment you treat it as a boundary, you get a lawful split: suspects who satisfy the clue remain; suspects who contradict it become permanently illegal.

Rule
If a clue does not forbid anything, it does not constrain. If it does not constrain, it should not drive your decisions.

1.5 The Invariant You Were Already Protecting

Every strong Carmen run has an unspoken invariant:

Invariant
After each clue is processed, every remaining suspect and destination is still possible under all clues so far.

When you violate that invariant by keeping a suspect that a clue disproved, you do not merely 'make a mistake.' You corrupt the proof. From that moment on, every decision is built on a lie.

CCF treats this as non-negotiable: you are not allowed to proceed with a broken invariant. Either you repair it or you stop.

1.6 The Proof Engine in One Frame

A single Carmen turn is a frame. It contains the same moving parts you will later use in arrays, graphs, and systems:

  1. Observe: collect a clue (a constraint candidate).
  2. Decide: interpret it as a rule that forbids states.
  3. Eliminate: delete all candidates that contradict the rule.
  4. Record: store the rule in your clue ledger so you never re-scan the same meaning.
  5. Maintain: confirm the invariant still holds before moving on.

Notice what is missing: there is no guessing step. The frame is designed to make guessing unnecessary.

1.7 Why Brute Force Feels Wrong Here

You could try cities randomly. You could chase suspects by intuition. The game allows it, just like many programming problems allow brute force.

But the move budget exposes the truth: brute force is not 'bad' because it is slow; it is slow because it refuses to eliminate. It keeps the entire space alive and pays the cost of re-checking it over and over.

CCF calls the alternative irreversible elimination: once a state is proven impossible, it is never reconsidered. That single discipline is what turns chaos into calm.

1.8 The Calm Feeling Is a Signal

When you play well, you feel calm because your next move is justified. That calm is not personality. It is a property of the method.

CCF's goal is to make that same calm available in any domain: algorithms, interviews, system design, debugging, or decisions where correctness matters.

CCF translation
The game teaches 'Reasoning Before Memorization' in a world where no one calls it that. This book names what you already did and turns it into a repeatable discipline.

Chapter 2 - Narrative Layer vs Problem Space

The story motivates the hunt. The structure determines what is legal.

Narrative Layer vs Problem Space

2.1 The Narrative Layer

Carmen 'steals a statue.' A witness 'saw the suspect near a caf'.' A villain 'boards a plane at midnight.' The game wraps every step in story so your brain stays engaged. That wrapper is the narrative layer: the human-facing presentation of events, clues, and urgency.

In Carmen, a 'world' can be as simple as a neighborhood. Some neighborhoods feel like a straight street: you walk forward and collect facts. Others feel like a map: you move by connections. You don't need the full catalog yet. You only need the instinct that different mysteries demand different movement.

The narrative layer is not fake. It is simply not governing. It does not determine whether a move is correct. It determines whether the move feels like it belongs in a chase movie.

In algorithm work, the narrative layer is the problem statement: the thief, the treasure, the schedule, the 'cool' setting. It is what you read first, and what must be peeled away first.

2.2 The Problem Space

Under the story sits the problem space: the actual world that your reasoning operates on. In Carmen, that world is built from concrete objects and relations:

This is the world where correctness lives. The game never asks, 'What would make a good story next?' It asks, 'Given what you know, what can still be true?' That question is always asked inside the problem space.

2.3 Why This Separation Matters

Most algorithm confusion starts here: people keep reasoning inside the story. They treat the narrative as the mechanism. That produces two classic failures:

CCF is strict about this: the narrative may explain why you care, but only the problem space can explain what is correct.

2.4 The Carmen Translation (Story ? Structure)

Here is the core move you will repeat for every chapter in this book: translate narrative into structure without adding new meaning. Think of it as a proof step: you are rewriting the same situation into a form where legality can be tested.

Translation Rule
Replace every story sentence with one of these primitives: constraint, boundary, feasibility, movement, or time budget.

Examples:

Notice what we did not do: we did not 'interpret' the story into extra assumptions. We did not invent probabilities. We did not add psychology. We reduced story to legality.

2.5 The Two Maps You Carry

When you play well, you are carrying two maps at once:

The narrative map keeps you motivated. The constraint map keeps you correct. In CCF terms, the constraint map is the feasible region of the search: the set of states that still satisfy the known rules.

A strong player updates the constraint map after every clue. A weak player updates only the narrative map, and then wonders why the chase feels random.

2.6 CCF Alignment: Intent Lives Above, Correctness Lives Below

This chapter connects directly to the first CCF move: intent. Intent is allowed to be human. It can be narrative. 'Catch Carmen.' 'Find the stolen object.' 'Stop the villain.' Intent explains the goal.

But the next move, shape, cannot be narrative. Shape is the problem space. Shape defines what counts as a state, what counts as a move, and what counts as elimination. If you keep the story in the driver's seat, your shape will be vague, and your scanner will wander.

So treat this as a hard boundary in your thinking:

Once you adopt this boundary, you stop asking the wrong questions. You stop hunting for 'clever' tricks. You start hunting for the rules that collapse the search.

2.7 A Mini Proof Exercise

Take the following story lines and rewrite them into problem-space statements. Do not add meaning. Only convert to constraints, boundaries, and legality.

  1. 'The suspect spoke Spanish and paid in pesos.'
  2. 'The suspect boarded a boat after sunset.'
  3. 'The suspect mentioned a desert and a famous pyramid.'

Your answers should look like this:

That is the mental move that makes everything else in this book possible. You are not learning trivia. You are learning to convert stories into structures and then prove your way to the answer.

Chapter 2 Guarantee
If you can separate narrative from problem space, you can stop 'searching' and start eliminating. The next chapter shows why every clue is a constraint, and how constraints become a repeatable algorithm.

Chapter 3 - Clues Are Constraints

A clue is only powerful when it forbids something.

Clues Are Constraints

3.1 The Moment a Clue Becomes Algorithmic

A clue begins as a sentence. It becomes algorithmic only when you convert it into a constraint: a rule that makes part of the world illegal.

If a clue does not forbid any suspects, any locations, or any movements, then it is not guiding correctness. It is only decoration in the narrative layer.

3.2 First Guess vs Final Answer

A good detective forms an early theory, then keeps reading. That's not indecision. That's discipline. Your first guess is a working hypothesis, useful for attention, not a verdict.

As more clues arrive, you either strengthen the theory or eliminate it. If one clue forbids it, it's gone. That is why you finish the prompt before you make the arrest.

Rule
A clue must shrink a search space. If it doesn't shrink anything, it isn't a constraint yet.

3.2 Constraints Are Boundaries, Not Facts

Players often treat clues as trivia: 'French,' 'yen,' 'motorcycle,' 'pyramids.' But correctness does not come from remembering words. It comes from drawing boundaries.

A boundary divides the world into two regions:

This is why strong Carmen play feels calm. Every clue draws a line. Every line removes work.

3.3 The Two Constraint Targets

In Carmen, a clue can constrain two different worlds:

The best clues usually constrain both. A landmark clue (Eiffel Tower) collapses location. A trait clue (motorcycle) collapses suspects. A currency or language clue often collapses both.

3.4 Three Types of Clues (Hard, Soft, and Structural)

Not every clue has the same strength. In CCF terms, you should classify the clue before you let it drive elimination.

Type A - Hard constraints

They directly forbid candidates.

  • Trait hard constraint: 'Drives a motorcycle' eliminates suspects.
  • Landmark hard constraint: 'Saw the Eiffel Tower' eliminates locations.
Type B - Soft constraints

They narrow plausibility but may not be unique on their own.

  • 'Ate sushi' suggests a region, but does not prove a single place.
  • 'Wore a heavy coat' suggests climate, but needs reinforcement.
Type C - Structural constraints

They restrict movement and what your scanner is allowed to assume.

  • Time budget: some routes become impossible.
  • Travel edges: you can only move along valid connections.

Hard constraints enable immediate elimination. Soft constraints become powerful when they stack. Structural constraints shape what information you can reach in time.

3.5 Constraint Stacking Is Intersection

A single constraint draws a line. Multiple constraints draw a shape.

Every new clue intersects the remaining feasible region. This is why the game accelerates: the space shrinks faster as the constraints accumulate.

Invariant reminder
After applying each clue, the feasible region must still contain the true answer. If your elimination removes the truth, your proof is broken.

3.6 Converting a Clue Into a Decision Rule

A clue is a sentence. A constraint is a rule. A rule needs a test.

So every time you read a clue, force yourself to produce a decision rule in this form:

Decision rule template
If a candidate contradicts the clue, then eliminate it permanently.

Example:

That single conversion step is the bridge between story and computation.

3.7 The Most Common Failure: Treating Ambiguity as Permission

Some clues are vague. Vague does not mean 'do nothing.' It means 'do not over-eliminate.'

When a clue is soft or ambiguous, the correct move is to constrain gently and wait for stacking to sharpen it. In CCF terms, you preserve the invariant by avoiding unjustified elimination.

Safety rule
When in doubt, keep the candidate and record the clue. Let the next constraint do the cutting.

3.8 What This Teaches You About Real Algorithms

Most programming problems hide constraints inside innocent-looking sentences: 'sorted,' 'contiguous,' 'must be unique,' 'minimize,' 'no extra memory.' Those are not details. They are the blades that make elimination legal.

Carmen trains the exact instinct you need for CCF: treat every hint as a boundary, convert it into a rule, apply it to shrink the space, and confirm the invariant still holds.

Chapter 3 takeaway
Clues are constraints. Constraints are boundaries. Boundaries enable elimination. Elimination produces certainty.
Starter chapter boundary reached

Continue with Starter Access

Chapter 4 and beyond require Starter Access or higher. Upgrade to continue the Scanner investigation and complete Book Zero.

Upgrade Now

Author

Garonzick D. Hall
Software Engineer - Correct Code Press