Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Learn the direction of a moving agent

Tags:

netlogo

I created a turtle in NetLogo which is moving randomly and there are some obstacles. Is it possible to get its current direction? I want to get the turtle to walk back to the center when it sees an obstacle. I can calculate distance to the center, but since I don't know its direction I can't say forward or backwards, for example.

like image 428
Ecrin Avatar asked Feb 21 '23 16:02

Ecrin


1 Answers

The turtle's current direction is given by the heading variable. You can both read and write to this variable in order to change the turtle's heading. You can also change it using facexy as N. Payette mentioned.

like image 114
Jose M Vidal Avatar answered May 16 '23 08:05

Jose M Vidal