[Edu-sig] some turtle questions
Daniel Ajoy
da.ajoy at gmail.com
Wed Jan 27 21:36:52 CET 2010
On Mon, 25 Jan 2010 06:00:01 -0500, <edu-sig-request at python.org> wrote:
> I'm almost sure that there's no way for a turtle to know anything
> about the background. That's an unfortunate limitation!
In FMSLogo:
PIXEL
Description
Outputs a three element list of numbers that represent the red, green, and blue intensity of the pixel currently under the turtle.
> As for putting a limit on a turtle's travel, you need to write an
> appropriate conditional. For example, if you want your turtle to stay
> within a 200x200 square centered around the origin and stop if it gets
> out, do something roughly like:
>
> while(math.abs(t.xcor()) < 100 and math.abs(t.ycor()) < 100):
> move turtle
>
> Of course, you could instead use if statements and simulate bouncing
> (if my turtle's x coordinate is beyond my bounding box, subtract from
> its x coordinate).
In FMSLogo:
WINDOW
Description
Tells the turtle to enter "window" mode. From now on, if the turtle is asked to move past the boundary of the graphics window, it will move off screen. The visible graphics window is considered as just part of an infinite graphics plane; the turtle can be anywhere on the plane.
WRAP
Description
Tells the turtle to enter "wrap" mode. From now on, if the turtle is asked to move past the boundary of the graphics window, it will "wrap around" and reappear at the opposite edge of the window. The top edge wraps to the bottom edge, while the left edge wraps to the right edge. (So the window is topologically equivalent to a torus.) This is the turtle's initial mode.
FENCE
Description
Tells the turtle to enter "fence" mode. From now on, if the turtle is asked to move past the boundary of the graphics window, it will move as far as it can and then stop at the edge with an "out of bounds" error message.
Daniel
http://sourceforge.net/projects/fmslogo/files/
More information about the Edu-sig
mailing list