Link-Walking Turtles Example

Link-Walking Turtles Example preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

code example 

Tagged by Reuven M. Lerner almost 7 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 4209 times • Downloaded 206 times • Run 12 times
Download the 'Link-Walking Turtles Example' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

un-linked walking of turtles. (Question)

Hi there! This example model has been supremely helpful for me but I would rather like a few modifications done in this and would rather like a bit of help. How can a particular traffic of turtles be directed towards a particular node on basis of some score of the node and yes the nodes must not be connected.

Posted 10 months ago

Click to Run Model

breed [nodes node]
breed [walkers walker]

walkers-own [location]  ;; holds a node

to setup
  clear-all
  set-default-shape nodes "circle"
  ;; create a random network
  create-nodes 30 [ set color blue ]
  ask nodes [ create-link-with one-of other nodes ]
  ;; lay it out so links are not overlapping
  repeat 500 [ layout ]
  ;; leave space around the edges
  ask nodes [ setxy 0.95 * xcor 0.95 * ycor ]
  ;; put some "walker" turtles on the network
  create-walkers 5 [
    set color red
    set location one-of nodes
    move-to location
  ]
  reset-ticks
end 

to layout
  layout-spring nodes links 0.5 2 1
end 

to go
  ask links [ set thickness 0 ]
  ask walkers [
    let new-location one-of [link-neighbors] of location
    ;; change the thickness of the link I just crossed over
    ask [link-with new-location] of location [ set thickness 0.5 ]
    face new-location  ;; not strictly necessary, but improves the visuals a bit
    move-to new-location
    set location new-location
  ]
  tick
end 


; Public Domain:
; To the extent possible under law, Uri Wilensky has waived all
; copyright and related or neighboring rights to this model.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 6 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 7 years ago Updated version tag Download this version
Uri Wilensky almost 8 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 9 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 9 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 9 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 9 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 9 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 9 years ago Link-Walking Turtles Example Download this version
Uri Wilensky over 9 years ago Link-Walking Turtles Example Download this version

Attached files

File Type Description Last updated
Link-Walking Turtles Example.png preview Preview for 'Link-Walking Turtles Example' over 6 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.