Hex Turtles Example

Hex Turtles Example preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

code example 

Tagged by Reuven M. Lerner over 9 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 267 times • Downloaded 35 times • Run 0 times
Download the 'Hex 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

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

Click to Run Model

to setup
  clear-all
  set-default-shape turtles "arrow half"
  crt 500
    [ move-to one-of patches
      ;; turtle headings must be multiples of 60
      set heading 60 * random 6
      ;; shift even columns down
      if pxcor mod 2 = 0
        [ set ycor ycor - 0.5 ] ]
  reset-ticks
end 

to go
  ;; turtles do a random walk (usually going straight,
  ;; occasionally turning)
  ask turtles
    [ hex-fd
      rt one-of [-60 0 0 0 0 0 60] ]
  tick
end 

to hex-fd  ;; turtle procedure
   ;; the world must be an even size grid so that when the turtles wrap
   ;; there are not two even or two odd columns in a row.
   setxy (xcor + item (heading / 60) [0 1 1 0 -1 -1])
         (ycor + item (heading / 60) [1 0.5 -0.5 -1 -0.5 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 9 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky almost 10 years ago Updated version tag Download this version
Uri Wilensky over 10 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 12 years ago Hex Turtles Example Download this version
Uri Wilensky over 12 years ago Hex Turtles Example Download this version

Attached files

File Type Description Last updated
Hex Turtles Example.png preview Preview for 'Hex Turtles Example' over 9 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.