cover

The Literal Robot

How does coding work, and how do we tell a computer what to do?
A computer is a marvel โ€” it can do **millions of things a second** โ€” but ~~here's the funny secret:~~ it cannot guess wh

A computer is a marvel โ€” it can do millions of things a second โ€” but here's the funny secret: it cannot guess what you want. Not even a little. It's the most powerful, most clueless friend you'll ever have. So how do we get it to do anything at all? We write it a list of very, very clear instructions. That's coding.

Imagine teaching a friend to make a peanut butter sandwich, but they **take every word literally**. You say "put peanut

Imagine teaching a friend to make a peanut butter sandwich, but they take every word literally. You say "put peanut butter on the bread," and they set the whole jar on top. You forgot to say "open the jar, scoop it, spread it." Computers are exactly like that. Coding is the art of leaving nothing to imagination.

So we break every task into baby steps, in order. Step one, then two, then three. This ordered list of steps is called a

So we break every task into baby steps, in order. Step one, then two, then three. This ordered list of steps is called an algorithm โ€” a fancy word for "the recipe." A recipe for cookies and a recipe for a video game are the same idea: do this, then this, then this.

~~But there's a catch.~~ Computers don't speak English, or any human language. Deep down, they only understand two thing

But there's a catch. Computers don't speak English, or any human language. Deep down, they only understand two things: on and off, like a light switch. We write those as 1 and 0. Every word, photo, and song inside a computer is really just millions of tiny switches flicking on and off.

Flicking switches by hand would take forever, so clever people invented programming languages โ€” like ++Python++, ++Java+

Flicking switches by hand would take forever, so clever people invented programming languages โ€” like Python, Java, or Scratch. These let us write instructions in something close to readable words. We type "if it rains, take the umbrella," and the language does the boring work of turning our sentence into all those tiny switches.

A ++translator++ does that **magic** for us. It's a special program that reads our friendly code and rewrites it into th

A translator does that magic for us. It's a special program that reads our friendly code and rewrites it into the on-and-off language the machine actually obeys. Think of it as an interpreter at the airport, standing between you and someone who speaks only Switch.

Real instructions need a few clever tricks. We tell computers to make choices โ€” "~~IF the door is locked, THEN knock.~~"

Real instructions need a few clever tricks. We tell computers to make choices โ€” "IF the door is locked, THEN knock." We tell them to repeat things โ€” "do this 100 times" โ€” so we don't have to write it 100 times. And we give them little boxes called variables to remember things, like a score that climbs as you play.

~~And here's the honest part:~~ **the first try almost never works**. A tiny mistake โ€” a missed comma, a wrong number โ€”

And here's the honest part: the first try almost never works. A tiny mistake โ€” a missed comma, a wrong number โ€” and the whole thing sputters. We call those mistakes bugs, and hunting them down is called debugging. Every coder, even the brilliant ones, spends loads of time being gently outwitted by a single typo.

So that's the whole trick. Coding is just giving a **very literal, very fast friend** a recipe so clear it can't be misu

So that's the whole trick. Coding is just giving a very literal, very fast friend a recipe so clear it can't be misunderstood โ€” step by step, choice by choice, switch by switch. We're not commanding a genius. We're being patient teachers to a machine that does exactly, precisely, only what we say.

How was this book?

A Wonderleaf Book

The Literal Robot

โ€” How does coding work, and how do we tell a computer what to do? โ€”

Wonderleaf Editions
โ€” ex libris โ€”
A Wonderleaf Book

The Literal Robot

How does coding work, and how do we tell a computer what to do?

Wonderleaf Editions ยท MMXXVI
Scene 1
A computer is a marvel โ€” it can do **millions of things a second** โ€” but ~~here's the funny secret:~~ it cannot guess wh
The Literal Robot2
Scene 1

A computer is a marvel โ€” it can do millions of things a second โ€” but here's the funny secret: it cannot guess what you want. Not even a little. It's the most powerful, most clueless friend you'll ever have. So how do we get it to do anything at all? We write it a list of very, very clear instructions. That's coding.

3The Literal Robot
Scene 2
Imagine teaching a friend to make a peanut butter sandwich, but they **take every word literally**. You say "put peanut
The Literal Robot4
Scene 2

Imagine teaching a friend to make a peanut butter sandwich, but they take every word literally. You say "put peanut butter on the bread," and they set the whole jar on top. You forgot to say "open the jar, scoop it, spread it." Computers are exactly like that. Coding is the art of leaving nothing to imagination.

5The Literal Robot
Scene 3
So we break every task into baby steps, in order. Step one, then two, then three. This ordered list of steps is called a
The Literal Robot6
Scene 3

So we break every task into baby steps, in order. Step one, then two, then three. This ordered list of steps is called an algorithm โ€” a fancy word for "the recipe." A recipe for cookies and a recipe for a video game are the same idea: do this, then this, then this.

7The Literal Robot
Scene 4
~~But there's a catch.~~ Computers don't speak English, or any human language. Deep down, they only understand two thing
The Literal Robot8
Scene 4

But there's a catch. Computers don't speak English, or any human language. Deep down, they only understand two things: on and off, like a light switch. We write those as 1 and 0. Every word, photo, and song inside a computer is really just millions of tiny switches flicking on and off.

9The Literal Robot
Scene 5
Flicking switches by hand would take forever, so clever people invented programming languages โ€” like ++Python++, ++Java+
The Literal Robot10
Scene 5

Flicking switches by hand would take forever, so clever people invented programming languages โ€” like Python, Java, or Scratch. These let us write instructions in something close to readable words. We type "if it rains, take the umbrella," and the language does the boring work of turning our sentence into all those tiny switches.

11The Literal Robot
Scene 6
A ++translator++ does that **magic** for us. It's a special program that reads our friendly code and rewrites it into th
The Literal Robot12
Scene 6

A translator does that magic for us. It's a special program that reads our friendly code and rewrites it into the on-and-off language the machine actually obeys. Think of it as an interpreter at the airport, standing between you and someone who speaks only Switch.

13The Literal Robot
Scene 7
Real instructions need a few clever tricks. We tell computers to make choices โ€” "~~IF the door is locked, THEN knock.~~"
The Literal Robot14
Scene 7

Real instructions need a few clever tricks. We tell computers to make choices โ€” "IF the door is locked, THEN knock." We tell them to repeat things โ€” "do this 100 times" โ€” so we don't have to write it 100 times. And we give them little boxes called variables to remember things, like a score that climbs as you play.

15The Literal Robot
Scene 8
~~And here's the honest part:~~ **the first try almost never works**. A tiny mistake โ€” a missed comma, a wrong number โ€”
The Literal Robot16
Scene 8

And here's the honest part: the first try almost never works. A tiny mistake โ€” a missed comma, a wrong number โ€” and the whole thing sputters. We call those mistakes bugs, and hunting them down is called debugging. Every coder, even the brilliant ones, spends loads of time being gently outwitted by a single typo.

17The Literal Robot
Scene 9
So that's the whole trick. Coding is just giving a **very literal, very fast friend** a recipe so clear it can't be misu
The Literal Robot18
Scene 9

So that's the whole trick. Coding is just giving a very literal, very fast friend a recipe so clear it can't be misunderstood โ€” step by step, choice by choice, switch by switch. We're not commanding a genius. We're being patient teachers to a machine that does exactly, precisely, only what we say.

19The Literal Robot

~ finis ~

Tiny picture books for big little questions.

โ€” a small constellation of questions โ€”
โœฆWonderleaf
Editions