Computer Science, asked by jahangirahmad000520, 2 months ago

the turtle should be turned through a total of 360 units for drawing a circle ?​

Answers

Answered by paraspandey215
1

Answer:

Logo is best known as the language that introduced the turtle as a tool for computer graphics. In fact, to many people, Logo and turtle graphics are synonymous. Some computer companies have gotten away with selling products called "Logo" that provided nothing but turtle graphics, but if you bought a "Logo" that provided only the list processing primitives we've used so far, you'd probably feel cheated.

Historically, this idea that Logo is mainly turtle graphics is a mistake. As I mentioned at the beginning of Chapter 1, Logo's name comes from the Greek word for word, because Logo was first designed as a language in which to manipulate language: words and sentences. Still, turtle graphics has turned out to be a very powerful addition to Logo. One reason is that any form of computer graphics is an attention-grabber. But other programming languages had allowed graphics programming before Logo. In this chapter we'll look at some of the reasons why turtle graphics, specifically, was such a major advance in programming technology.

This chapter can't be long enough to treat the possibilities of computer graphics fully. My goal is merely to show you that the same ideas we've been using with words and lists are also fruitful in a very different problem domain. Ideas like locality, modularity, and recursion appear here, too, although sometimes in different guises.

A Review, or a Brief Introduction

I've been assuming that you've already been introduced to Logo turtle graphics, either in a school or by reading Logo tutorial books. If not, perhaps you should read one of those books now. But just in case, here is a very brief overview of the primitive procedures for turtle graphics. Although some versions of Logo allow more than one turtle, or allow dynamic turtles with programmable shapes and speeds, for now I'll only consider the traditional, single, static turtle.

Type the command cs (short for clearscreen), with no inputs. The effect of this command is to initiate Logo's graphics capability. A turtle will appear in the center of a graphics window. (Depending on which version of Logo you have, the turtle may look like an actual animal with a head and four legs or--as in Berkeley Logo--it may be represented as a triangle.) The turtle will be facing toward the top of the screen. Any previous graphic drawing will be erased from the screen and from the computer's memory.

The crucial thing about the turtle, which distinguishes it from other metaphors for computer graphics, is that the turtle is pointing in a particular direction and can only move in that direction. (It can move forward or back, like a car with reverse gear, but not sideways.) In order to draw in any other direction, the turtle must first turn so that it is facing in the new direction. (In this respect it is unlike a car, which must turn and move at the same time.)

The primary means for moving the turtle is the forward command, abbreviated fd. Forward takes one input, which must be a number. The effect of forward is to move the turtle in the direction it's facing, through a distance specified by the input. The unit of distance is the "turtle step," a small distance that depends on the resolution of your computer's screen. (Generally, one turtle step is the smallest line your computer can draw. This is slightly oversimplified, though, because that smallest distance may be different in different directions. But the size of a turtle step does not depend on the direction; it's always the same distance for any given computer.) Try typing the command

Similar questions