Hatch Example

Hatch 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 692 times • Downloaded 102 times • Run 1 time
Download the 'Hatch 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

turtles-own [ age ]

to setup
  clear-all
  ;; create turtles at evenly spaced angles
  ;; and colors in order rather than randomly
  create-ordered-turtles 3 [
    set color pink
    fd 3
  ]
  reset-ticks
end 

to go
  if not any? turtles [ stop ]
  ask turtles [
    wander
    reproduce
    grow-old
  ]
  tick
end 

to grow-old
  set age age + 1
  if age > 50 [ die ]
end 

to wander
  rt random 360
  fd 0.5
end 

to reproduce
  if color = pink and random 5 = 0 [
    hatch 1 [
      if random 10 > 0 [ set color blue ]   ;; 9 of 10 hatched turtles turn blue
      set age 0
    ]
  ]
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 Hatch Example Download this version
Uri Wilensky over 14 years ago Hatch Example Download this version

Attached files

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

This model does not have any ancestors.

This model does not have any descendants.