NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 NetLogo Publications
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Farsi / Persian
 Japanese
 Spanish

  Donate

NetLogo Models Library:
Code Examples

(back to the library)

Move Towards Target Example

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web

WHAT IS IT?

This code example demonstrates how to have a turtle approach a target location a step at a time.

HOW IT WORKS

The people breed has a variable called target, which holds the agent the person is moving towards.

The face command points the person towards the target. fd moves the person. distance measures the distance to the target.

When a person reaches their target, they pick a random new target.

(back to the NetLogo Models Library)