reset password
Author Message
rabbott
Posts: 1649
Posted 17:08 Apr 07, 2020 |

Besides the example we looked at, NetLogo has three models in which agents move around in the world using the world itself as a framework for moving. The examples are all in the Code Examples directory.

They are

Lattice-Walking Turtles Example,

Link-Walking Turtles Example, and

Random Grid Walk Example,

Feel free to use any of these strategies to model the roads and the commuters moving along the roads. I think the Link-Walking example is most interesting. You can model a road as two points with a link between them. Then you can have the commuters move a certain distance along the implicit path defined by the link. The  Link-Walking example suggests as an extension to animate the motion of the turtles. This is close to what you would be doing. To use this approach, look at some of the Agent.move_ methods.

 

Last edited by rabbott at 17:10 Apr 07, 2020.
rabbott
Posts: 1649
Posted 09:56 Apr 08, 2020 |

Other Agent methods you might find useful:

def current_patch(self) -> Patch:
def distance_to(self, other):
def heading_toward(self, target):
def face_xy(self, xy: Pixel_xy):
def set_velocity(self, velocity):
def turn_left(self, delta_angles):
def turn_right(self, delta_angles):
def set_velocity(self, velocity):
def x(self):
def y(self):
Last edited by rabbott at 09:58 Apr 08, 2020.