If the goal is to RETRACE the line drawn than the two methods mentioned so far would be what you want. However if the goal is only to get the turtle back to the point where the 'fd random 150' was issued than you could save the turtles position, make "savedPosition pos, and then sometime later issue a 'setpos :savedPosition. If the heading of the turtle at :savedPosition is important than save it also. make "savedState list pos heading ; setpos first :savedState setheading last :savedState. In MicroWorlds the turtle variables (created with 'turtlesown') are great for saving this type of information. Create two turtle variables savedPosition and savedHeading. Then even with multiple turtles you can easily save and access the data. This can be expanded to contain all manner of turtle specific data; shape, size, etc. The turtle variables begin to suggest the power of object oriented programming. That is the object (in this case the turtle) carries around it's own state. Of course here we're only dealing with data, while in a true oo environment code would also be part of the state. It is possible with the turtle variables to attach code as a list and then to 'run' the list. It can get a bit sticky though. In MSWLogo property lists can do what turtle variables do in MicroWorlds. Check out the projects at my site, specifically 'motion' for a look at some of these ideas. Hope this helps and maybe suggests some areas to explore. regards -- Frank Caggiano caggiano@atlantic.net http://www.atlantic.net/~caggiano --------------------------------------------------------------- Please post messages to the Logo forum to logo-l@gsn.org. Mail questions about the list administration to logofdn@gsn.org. To unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home