Information Technology Reference
In-Depth Information
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)!”
Search WWH ::
Custom Search