I have a NetLogo model that requires a turtle to record its distance travelled from point A to B.
It is important that the distance is measured by the turtle rather than simply calculating the distance between the two points.
I think something like turtles-own would be sufficient to store the distance it has travelled?
I assume that you don't want to just use the
distance
from the original point because it's possible that your turtle has not traveled in a straight line?In any case, it is certainly possible to use a
turtles-own
variable. Here is a complete example:That assumes you're using
forward
to move the turtle. If you're usingsetxy
to move the turtle, you'd need to replace theask turtles
block with: