Lauren Ipsum: A Story About Computer Science and Other Improbable Things (4 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
5.51Mb size Format: txt, pdf, ePub
Chapter 6. A Tinker’s Trade

When Laurie and Xor were safely inside the town walls, the little lizard popped his head out
of Laurie’s pocket.

“See what I mean? Let’s hope they don’t figure out what you did to get in
here,” Xor said. “So, why are we here?”

“We’re looking for information that could help me get home. Maybe we can find a
map or something.”

“Oh,” said Xor. “I was hoping you were going to say food. Why don’t we
try this place?”

In front of them was a storefront with a very fancy sign painted on the window:


Al-go-rith-ms
. That sounds like a kind of fruit.”

“Are you
always
hungry, Xor?”

“Time flies like an arrow, and fruit flies like a banana. Let’s see if
there’s a fruit fly problem I can help them solve.”

A bell jingled as Laurie opened the door. “Hello, hello!” the shopkeeper said.
“And welcome to my shop. I’m Tinker, and you are looking for a finely crafted algorithm,
am I right?”

Laurie looked at the items listed on the chalkboard, but they didn’t make any
sense.

“I’m not sure. What
is
an algorithm? Can you eat it?”
asked Laurie.

“What? No, it’s just a fancy way of saying ‘how to do something.’ But
Algorithm
looks more impressive on the sign,” said Tinker.

Xor turned orange with disappointment.

“How to do something,” repeated Laurie. “In that case, I want to find a
sensible way to visit every town.”

“That sounds like an interesting problem. What have you been doing so far?”

Laurie told Tinker about her adventure in the Red-Black Forest and her visit with Eponymous
Bach.

“A Hamiltonian path, eh?” said Tinker. “That’s a tough one. I hate to
say it, because he sounds like a nice person, but the Wandering Salesman might take a long, long
time to finish his tour of all the towns.”

“Oh, no! But why?”

“If you always go to the nearest town you haven’t visited yet, you might miss a
town that’s just a little farther away. Then you go to another town that’s closer to you
but still farther from the one you missed, and so on. You can end up crisscrossing the whole country
to get to the last few towns.”

“That sounds exhausting,” said Laurie. The Wandering Salesman wasn’t so
sensible after all! “So how do I find the shortest path?”

“I’ll see what I have in stock. But it might be expensive.”

“I don’t have much money with me,” Laurie said. She took a few quarters from
her pocket and showed them to Tinker.

He looked at them with surprise. “Quarter Dollar? I don’t know what a Dollar is,
never mind a quarter of one. Is this money where you come from?”

“Of course it’s money! That’s seventy-five cents,” she said.

“Cents? We use Fair Coins here.”

“What’s a Fair Coin?”

“Well, they are a bit bigger than these Quarter Dollars of yours, but not nearly as
pretty! You can tell genuine Fair Coins because they always flip heads or tails,
fifty-fifty.”

“But you can flip quarters fifty-fifty, too!”

“That may be true, but I can’t just take
your
word for it,
can I? Here, all Fair Coins must be certified Fair.”

Laurie was crestfallen.

“Don’t look so sad! I do want to help you,” said Tinker. “Maybe we can
do a trade. It so happens I’m in the market for a particular algorithm.”

“But I don’t have any algorithms, either,” said Laurie.

“That’s not a problem,” said Tinker. “You can compose new ones any
time you want, with a little bit of thinking.”

“I can? How?”

“Well, everyone develops their own style. You can put little ideas together to make big
ideas. Or you put two ideas side by side and compare them. Or you start with big ideas and take them
apart.”

“You mean like Eponymous does?”

“Yes, just like her. She’s a great Composer.”

Laurie had never thought that
she
could do things like that herself. But
Tinker seemed to think it was normal.

“So what do I do?”

“The algorithm I’m looking for is how to draw a circle,” Tinker said.
“It’s a tough one, so you’ll have to use your imagination. I’ve asked all
the adults and even Ponens and Tollens already, but all they do is mutter about
x
squared plus
y
squared and never get
anywhere.”

“Take a look at this.” He handed Laurie a wind-up toy animal. It had a Shell, and
was Round and Green. “This turtle can do three things: it can move forward or backward, it can
turn, and it can draw a little dot on the paper.”

“Hey, that’s pretty neat!”

“Yes, but the thing is, it doesn’t know how to do anything else. That’s
where the algorithm comes in.” Tinker took out a piece of paper and wrote what looked like a
little poem:

Go forward one inch,

make a mark,

repeat five times.

Then he wound up the turtle and placed it on the poem. It went
zzzrbt bzzaap
whuzzzsh
, and so on. Then it drew a line of dots, just like the poem said:

“You see? If you put little ideas together, you can make bigger ones,” Tinker
said. “And you can compose
those
ideas into even bigger and bigger
ones.”

“How do you do that?” asked Laurie.

“By giving them a name. You can use the name like a handle: you’d carry a pot of
soup by the handle, and you can move around an entire idea just by writing its name. Here,
let’s call the first idea
LINE
. Then you can put four lines together to
make a square.”

LINE
:

Go forward one inch,

make a mark,

repeat five times.

SQUARE
:

Make a
LINE
,

Make a right turn,

repeat four times.

Make a
SQUARE
.

The little turtle
zzzrbt
ed and
whuzzzsh
ed and
bzzaap
ed, then drew this:

Laurie was amazed. It was like magic, but every step made sense.

“So, knowing what the turtle can do, can you teach it how to draw a circle?”
Tinker asked.

“I don’t know,” Laurie said, “but I want to try!”

“That’s good enough for me. Here, you can work at my desk. There’s plenty of
paper and compasses and things like that.”

Laurie sat down at Tinker’s desk. She doodled with the compass and played with the
turtle for a while, trying to remember what she knew about circles.

A circle is round. No, not just round—perfectly round. You put the pin in the
center, and the pencil spins around. To make a bigger one, you open the compass; to make a smaller
one, you close the compass. If you change the width of the compass when it’s spinning, it
doesn’t make a circle . . .

Suddenly an idea, or maybe a memory, popped into her head:
a circle is all of the
points that are exactly the same distance from the center. Hmm, what if you . . .

Go forward
one inch
,

make a mark,

go back
one inch
,

turn right a tiny bit,

then repeat!

After Laurie wrote out her poem, she wound up the little turtle again and placed it on the
paper. It buzzed and burbled for a moment, then drew this:

“It’s working!” she called to Tinker. “Hey, it’s not
stopping.” The turtle was drawing over dots it had already drawn.

Other books

Carnifex by Tom Kratman
All the Names by José Saramago
The Value of Vulnerability by Roberta Pearce
The Memory Game by Sant, Sharon
La espada encantada by Marion Zimmer Bradley
Speechless by Fielding, Kim
Passing Time by Ash Penn
Dolan's Cadillac by Stephen King