Lauren Ipsum: A Story About Computer Science and Other Improbable Things (18 page)

Read Lauren Ipsum: A Story About Computer Science and Other Improbable Things Online

Authors: Carlos Bueno

Tags: #COMPUTERS / Computer Science

BOOK: Lauren Ipsum: A Story About Computer Science and Other Improbable Things
2.81Mb size Format: txt, pdf, ePub
Chapter 16: A Change of Plan
Bruto Fuerza

This lighthouse keeper thinks the answer to every problem is more power and brute force. Even
if he builds a lighthouse twice as tall, twice as wide, and twice as thick as the one that failed,
the new one will still fall over eventually because he’s following the same plan.

Yet in his own way, Bruto is right when he decides to build a pyramid instead. Pyramids are
much sturdier, and if you pile on enough bricks, you could eventually make a pyramid tall enough to
be a lighthouse. But Bruto’s plan has enormous costs: he needs a lot more bricks, a lot more
land to build on, and a lot more time to build.

Some programmers approach problems this way, too, but putting all your resources into a
brute-force attempt isn’t always a sensible answer. When your algorithm collapses, don’t
just pile on more bricks! Change your point of view, as Laurie did with the generals on the Island
of Byzantium, and you’ll find a more effective solution. See also
Five
Whys
(
Chapter 14
;
Chapter 14: In the Abstract
).

Chapter 17: Chasing Elegants
Elegants

They don’t really exist, but don’t you wish they did?

Fresnel

The Fresnel whom Laurie meets on Elegant Island is named after a real scientist named
Augustin-Jean Fresnel, who invented a way of focusing big lighthouse lights with only a little bit
of glass. He knew that lenses didn’t have to be large and thick to focus a beam of light, so
instead of one huge piece of glass, the
Fresnel lens
is an arrangement of small
pieces of glass at different angles. Lighthouses still use this type of lens today.

Decomposing

Decomposing
starts with a big idea and breaks it into smaller,
easier-to-understand pieces. When you know how to solve each smaller piece, you can combine those
ideas to solve a bigger problem. One good way to take an idea apart is to describe it without using
its name, just as Laurie did when she said you could also call a turtle a “Green Round animal
with a Shell.”

Even simple ideas, like the numbers 3 and 4, can be decomposed into simpler ideas. Start with
0 and then add 1. Then add 1 again, and so on:

0 = 0

1 = 0 + 1

2 = 0 + 1 + 1

3 = 0 + 1 + 1 + 1

If you really wanted to, you could just use 0 and 1 and ditch all of the other numbers. I
don’t recommend it—you’ll use up a lot of paper!—but it’s a perfectly
valid way to do math. For example, let’s break an addition problem down into nothing but 0s
and 1s:

2 + 2 = 4

would become

(0 + 1 + 1) + (0 + 1 + 1) = (0 + 1 + 1 + 1 + 1)

Relating

When you
relate
two ideas, you put them side by side and compare them,
like Fresnel’s balloon and a lighthouse. With numbers, you use the less-than sign (<) to
show that the number on the left is smaller than the one on the right. You use the equal sign (=) to
show that the value on the left is equal to the value on the right.

2 < 3

2 × 3 = 6

You can relate things besides numbers, though that means some relations are less precise.
Fresnel’s balloon isn’t
exactly
a lighthouse, but it’s
like
a lighthouse. We expect a lighthouse to have a way for people to climb up
high, somewhere to stand when they get there, and a big light that faraway ships can see.
Fresnel’s balloon technically has all of those things:

  • Fresnel’s balloon
    is-like-a
    lighthouse.

  • (elevator, balloon, light)
    is-like-a
    (staircase, tower, light).

Chapter 18: Many Hands Make Light Work
Network

Winsome created the Lighthouse Network to let people in Userland send messages faster. In
computer science, a
network
is a group of computers that are connected to one
another so that they can share information. Those computers could be connected through wires or even
the air!

Baudot

In 1870, Émile Baudot invented a code that represented letters with different groups of
1s and 0s. This code was meant to let people share messages using electricity: if you have a switch,
the power can either be on (1) or off (0). Naturally, Baudot named this code after himself. See
Bach’s Laws of Eponymy
(
Chapter 2
;
Bach’s First Law of Eponymy
).

We don’t use the Baudot code very often in the real world, but Ping, Fresnel, and the
other members of Winsome’s Lighthouse Network use it to send messages with their lights, which
can also be on (FLASH) or off (FLOOSH).

Here’s the Baudot code and the letter each number stands for, so you can make your own
Lighthouse Network. Grab some friends and some flashlights, and send each other messages!

Letter

Baudot code

Letter

Baudot code

A

11000

N

00110

B

10011

O

00011

C

01110

P

01101

D

10010

Q

11101

E

10000

R

01010

F

10110

S

10100

G

01011

T

00001

H

00101

U

11100

I

01100

V

01111

J

11010

W

11001

K

11110

X

10111

L

01001

Y

10101

M

00111

Z

10001

Chapter 19: Branching Out
The Garden of Forking Paths

The Garden has 16,777,216 paths, but in the end, Laurie and Xor each found exactly one path
that made sense for them. The number of possible paths became so small so fast because at each fork,
Laurie answered an either/or question, and that cut the number of possible paths in half.

Laurie’s journey through the Garden of Forking Paths is a lot like what computer
scientists call a
binary search
, which programmers use to look for a single
piece of information in a huge list quickly. When something is binary, it has only two
parts—just like the questions the Garden asked Laurie.

This little chart has four possible outcomes. If you answer the question “A or B?”
with A, you cut that number in half, leaving only two possibilities. Then, at A, you have to answer
“C or D?” Whichever option you pick, you’re cutting the number in half again, to
one choice.

In a binary search, you would ask similar questions about your giant list of information;
eventually, you’d cut the possibilities down to just one. Try it the next time you play Twenty
Questions! If you choose your questions (or answers) carefully, you can arrive at virtually anything
in only 20 or 30 steps. See also
Recursion
(
Chapter 4
;
Chapter 4: What the Tortoise Said to Laurie
).

Chapter 21: One More Thing
Telegraph

Captain Kevin Kelvin is laying wire along the ocean to create a
telegraph
network. Telegraph systems let people send messages to one another over long distances without
actually sending a physical object. Winsome’s Lighthouse Network is also a type of
telegraph!

In Kevin’s case, letters are represented by collections of sounds, not lights. Different
combinations of beeps and bloops represent different letters, and those beeps and bloops are made
when Kevin’s assistant presses a button attached to the other end of the wire. The telegraph
is just one of many systems people have used throughout history to talk to one another.

Kelvin Scale

Lord Kelvin was a real engineer who worked on telegraphs, but he’s best known for
creating the Kelvin scale to measure temperature. Unlike other temperature scales, the Kelvin scale
doesn’t use numbers less than zero, so the coldest temperature that anything can be is called
absolute zero
. Water freezes into ice at a whopping 273.16 Kelvin!

More Smart Books for Curious Kids!

PYTHON FOR KIDS

A PLAYFUL INTRODUCTION TO PROGRAMMING

by JASON R. BRIGGS

DEC 2012, 344 PP., $34.95

ISBN 978-1-59327-407-8

full color

RUBY WIZARDRY

AN INTRODUCTION TO PROGRAMMING FOR KIDS

by ERIC WEINSTEIN

DEC 2014, 360 PP., $29.95

ISBN 978-1-59327-566-2

two color

JAVASCRIPT FOR KIDS

A PLAYFUL INTRODUCTION TO PROGRAMMING

by NICK MORGAN

DEC 2014, 348 PP., $34.95

ISBN 978-1-59327-408-5

full color

SURVIVE!

INSIDE THE HUMAN BODY, VOL. 1

THE DIGESTIVE SYSTEM

by GOMDORI CO. and HYUN-DONG HAN

OCT 2013, 184 PP., $17.95

ISBN 978-1-59327-471-9

full color

SUPER SCRATCH PROGRAMMING ADVENTURE!

LEARN TO PROGRAM BY MAKING COOL GAMES

by THE LEAD PROJECT

OCT 2013, 160 PP., $24.95

ISBN 978-1-59327-531-0

full color

(Covers Version 2)

LEARN TO PROGRAM WITH SCRATCH

A VISUAL INTRODUCTION TO PROGRAMMING WITH GAMES, ART, SCIENCE, AND
MATH

by MAJED MARJI

FEB 2014, 288 PP., $34.95

ISBN 978-1-59327-543-3

full color

800.420.7240 or 415.863.9900 |
[email protected]
|
www.nostarch.com

Other books

Take One by Karen Kingsbury
Summer Loving by Cooper McKenzie
Night's Promise by Amanda Ashley
Death's Angel: A Novel of the Lost Angels by Killough-Walden, Heather
The Fall of Rome by Beth Ciotta
Leon Uris by Redemption