Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- breed [ passengers pax ] ;pax = passenger
- breed [ drivers driver ]
- drivers-own [ aggressiveness ]
- to init-model
- clear-all
- random-seed new-seed
- init-globals
- create-drivers init-drivers
- create-passengers init-passengers
- ask patches [init-patch]
- ask turtles [init-turtle]
- reset-ticks
- end
- to update-model
- update-globals
- ask patches [update-patch]
- ask turtles [update-turtle]
- tick
- end
- to init-globals
- ; initialize globals here
- end
- to init-patch
- ; initialize patches here
- end
- to init-turtle
- ifelse is-driver? self [ init-driver ] [ init-pax ]
- end
- to init-driver
- set shape "car"
- setxy random-xcor random-ycor
- end
- to init-pax
- set shape "person"
- setxy random-xcor random-ycor
- end
- to update-globals
- ; update global variables here
- end
- to update-patch
- ; update patches here
- end
- ;this conditional just checks whether its a driver or pax
- to update-turtle
- ifelse is-driver? self [ update-driver ] [ update-pax ]
- end
- to update-pax
- ; add commands
- end
- to update-driver
- ask patches in-cone driver-radius 360 [ set pcolor black ] ;tell all nearby patches near a car to set its self to black in a radius of 360
- driver-move ;calls the move function below
- ask patches in-cone driver-radius 360
- [ set pcolor scale-color [color] of myself driver-radius 0 15 ] ;tell all nearby patches near a car to set its self to a shade of the car's own color in a radius of 360
- ;increase the fade depending on the radius lookout of the car,
- ;currently being manually set my global slider
- end
- to driver-move
- rt random 360
- fd 1
- end
- ;here we are creating different behaviors
- ;drivers that go towards crowds
- ;drivers that stay away from crowds
- ;color patches based on near-by driver count
- ;hatch-pax on world click
- ;create links when nearest driver is found
- ;increase looking radius of a car after x amount of ticks, or a modulus of ticks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement