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

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

Book: Lauren Ipsum: A Story About Computer Science and Other Improbable Things Read Online Free PDF
Author: Carlos Bueno
Tags: COMPUTERS / Computer Science
. 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.
    “I think it’s because you told it to repeat, but not how many times,” said
Tinker.
    “Well, it should stop when the circle is done,” Laurie said.
    “It doesn’t really understand circles,” Tinker said. “It’s just
a toy turtle, remember? You have to teach it.”
    Laurie thought a little more, then rewrote her poem:
    CIRCLE :
    Go forward one inch ,
    make a mark,
    go back one inch ,
    turn right one degree,
    repeat three hundred sixty times.
    Then she realized that she could make circles of any size she wanted. It was just like opening
the compass wider.
    TWO-CIRCLE :
    Go forward two
inches ,
    make a mark,
    go back two inches ,
    turn right one degree,
    repeat three hundred sixty times.
    “This is interesting. You’re working really hard!” Tinker scratched his
head. “But as it is, it’s no good.”
    “Why?”
    “People want to make lots of different circles,” he said. “I’ll have
to keep a lot of algorithms of different sizes, just in case someone wants
three-and-nine-thirteenths inches or four-and-three-quarters inches.”
    “Well, what if you tell the turtle how big to make the circle?” she said.
“Maybe like this.”
    ANY-CIRCLE ( how-big? ):
    Go forward how-big? inches,
    make a mark,
    go back how-big? inches,
    turn right one degree,
    repeat three hundred sixty times.
    “And then ,” she said, “instead of ONE-CIRCLE or
TWO-CIRCLE, you can say ANY-CIRCLE(one), or (two), or even
(one-and-eleventy-sevenths)!”
    “Good idea, Laurie. That’s a lot simpler,” said Tinker. “I was worried
you were going to fill my shop with circles!”
    “You know, the turtle is drawing really slowly. Not like when it was drawing the
square,” she said.
    It was true. The turtle would crawl all the way to the edge of the circle, then make a mark,
then crawl all the way back to the center, 360 times. With small circles it wasn’t too bad,
but big circles took a lot longer.
    “Hmm,” Tinker said. “It spends a lot more time running
back and forth than it does making marks. Do you think you can reduce the running
time?”
    It makes sense, but it isn’t sensible. Laurie thought and doodled,
and doodled and thought, but she couldn’t figure out how to make it more sensible. The turtle
has to go back to the center, right? How else could it know where the edge of the circle was?
    Laurie let her eyes
Read Online Free Pdf

Similar Books

Wake

Elizabeth Knox

Eraser

Megan Keith

Hadrian's wall

William Dietrich