Link Lattice Example

Link Lattice Example preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

code example 

Tagged by Reuven M. Lerner almost 12 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 631 times • Downloaded 80 times • Run 2 times
Download the 'Link Lattice 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

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

to setup-square
  clear-all
  ;; Create a turtle on each patch. A link always connects two
  ;; turtles, so we must make turtles first before we can make
  ;; links.
  ask patches [ sprout 1 ]
  ;; Now create the links. Note that some turtles will try to create
  ;; links that already exist because they were made by earlier
  ;; turtles. That's OK; the CREATE-LINKS-WITH command will skip
  ;; links that already exist.
  ask turtles [ create-links-with turtles-on neighbors4 ]
end 

to setup-hex
  clear-all
  ;; Create a turtle on each patch. A link always connects two
  ;; turtles, so we must make turtles first before we can make
  ;; links.
  ask patches [ sprout 1 ]
  ;; Now create the links.
  ask turtles [
    create-links-with turtles-at 0 1
    create-links-with turtles-at 1 0
    if pxcor mod 2 = 0 [
      create-links-with turtles-at  1 -1
      create-links-with turtles-at -1 -1
      ;; Move every other column of turtles down by half a patch,
      ;; resulting in a hexagonal pattern.
      set ycor ycor - 0.5
    ]
  ]
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 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Link Lattice Example Download this version
Uri Wilensky over 14 years ago Link Lattice Example Download this version

Attached files

File Type Description Last updated
Link Lattice Example.png preview Preview for 'Link Lattice Example' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.