by Carlos Bueno
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
About the Author
Carlos Bueno is a former Facebook engineer who currently works at the database company MemSQL. He writes articles about computer science, programming, and the structure of the Internet.
Lauren Ipsum: A Story About Computer Science and Other Improbable Things
LAUREN IPSUM. Copyright © 2015 by Carlos Bueno.
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher.
18 17 16 15 14 1 2 3 4 5 6 7 8 9
ISBN-10: 1-59327-574-9
ISBN-13: 978-1-59327-574-7
Publisher: William Pollock
Production Editor: Riley Hoffman
Cover Design: Beth Middleworth
Illustrator: Miran Lipovača
Developmental Editor: Jennifer Griffith-Delgado
Copyeditor: Rachel Monaghan
Compositor: Riley Hoffman
Proofreader: Paula L. Fleming
For information on distribution, translations, or bulk sales, please contact No Starch Press, Inc. directly:
No Starch Press, Inc.
245 8th Street, San Francisco, CA 94103
phone: 415.863.9900; [email protected]
www.nostarch.com
Library of Congress Cataloging-in-Publication Data
Bueno, Carlos, 1979-
Lauren Ipsum : a story about computer science and other improbable things / Carlos Bueno.
pages cm
Summary: Lauren, a clever girl lost in Userland, applies logic and problem solving skills to find her
way home, encountering along the way such concepts as timing attacks, algorithm design, and the
traveling salesman problem.
ISBN 978-1-59327-574-7 -- ISBN 1-59327-574-9
[1. Computer science--Fiction. 2. Problem solving--Fiction. 3. Fantasy.] I. Title.
PZ7.1.B84Lau 2014
[Fic]--dc23
2014035552
No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and company names mentioned herein may be the trademarks of their respective owners. Rather than use a trademark symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.
The information in this book is distributed on an “As Is” basis, without warranty. While every precaution has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in it.
All characters in this publication are fictitious or are used fictitiously.
No Starch Press
2014-12-02T13:09:39-08:00
Bueno, Lauren Ipsum: A Story About Computer Science and Other Improbable Things