Part II · Chapter 6

The Recipe Follower

We have doors that decide, drawers that remember, and a steady heartbeat to keep time. Now we put them all on one workbench—and watch a fixed pile of switches become a machine that can do anything.

Every contraption we built so far had one job wired permanently into its bones. If you wanted a machine that counted, you soldered together a counting circuit. If you wanted a machine that blinked a lighthouse pattern, you built a completely different circuit. Changing the task meant grabbing a screwdriver and rewiring the workshop.

Then, in the middle of the last century, engineers stumbled upon an idea so simple and so astonishing that it reshaped the entire modern world: stop building a different machine for every task. Build one tireless chef who reads index cards.

Inside the Chef's Tiny Kitchen

Picture a remarkably small, tidy kitchen with only four things in it—and notice that we already built every single one of them in earlier chapters:

On every turn, the chef does the exact same three-beat dance, without ever improvising or getting bored. On Beat 1 (Fetch), the chef looks where the pointing finger is resting and lifts that card off the shelf. On Beat 2 (Read), the chef decodes what the card is asking. On Beat 3 (Act & Slide), the chef carries out the instruction—dropping pebbles, scooping them out, or copying them to a drawer—and slides the pointing finger down to the next card.

Lab 1 The 3-Beat Dance
Ready to Fetch

Click Next Beat step by step to watch a single index card travel from the shelf to the chef's hands and drop pebbles into the bowl.

Beat 1
Fetch Card
Beat 2
Read Rule
Beat 3
Act & Slide Finger
Card Shelf
Chef's Hands
Waiting for Beat 1...
Pebble Bowl
0 pebbles
The pointing finger is resting on Card 1. Press Next Beat to watch the chef lift it off the shelf.
Quiet footnote: Computer scientists call this endless three-beat rhythm the Fetch–Decode–Execute cycle, and the pointing finger is called the Program Counter.

One Fixed Machine, Endless Recipes

At first, this might seem almost disappointingly simple. Dropping pebbles and sliding a finger down a list? How could a kitchen that tiny ever do anything clever?

Here is the secret ingredient: a card is allowed to move the pointing finger itself.

Imagine Card 4 says, "Jump back to Card 1." Suddenly, a tiny stack of six cards can run for a thousand beats without ever running out of paper! Now imagine Card 3 says, "If the bowl has 10 pebbles, jump to Card 5." For the first time, the machine can look at what is in its own bowl and choose a different path based on what it sees.

Notice the miracle that just happened. The workbench below never rewires a single switch. The bowl stays the same. The drawers stay the same. Yet simply by swapping the six index cards on the shelf, the exact same machine can count by twos, fill and empty a bucket in a steady rhythm, or double its pebbles over and over again.

Lab 2 The Live Recipe Machine
Beat: 0

Pick a recipe below, then tap Step 1 Beat or Run to watch the exact same machine perform three completely different jobs.

Index Cards (Memory Shelf) Finger → Card 1
Pebble Bowl (Workbench) 0 pebbles
Drawer A 0
Drawer B 0
Recipe loaded: Count Up by Twos. The pointing finger rests on Card 1. Press Step 1 Beat or Run to wake the chef.
The Turning Point of the Book

Before this chapter, changing what a machine did meant changing the machine itself. Now, the machine stays frozen in metal and glass forever—and ideas written on cards bring it to life.

Quiet footnote: You have just met a real CPU (Central Processing Unit) inside a stored-program computer. The pebble bowl is called an accumulator, the stack of index cards is a program, and each card is a single machine instruction.

That completes Part II! Starting from a single flashlight in the dark, we have built decision doors, memory shelves, a self-buzzing heartbeat, and now a genuine recipe-following computer. Yet writing out tiny pebble-moving cards one by one is slow and tedious for human beings. In Part III, we will discover how people taught these patient machines to understand human-friendly words—and how to organize millions of drawers without losing a single thing.

What You Just Built