turtles-own [ age ] to setup ca cct 3 [ set color pink fd 2 ] end to go ask turtles [ wander reproduce grow-old ] plot count turtles if count turtles = 0 [ stop ] end to grow-old set age age + 1 if (age > 50) [ die ] end to wander rt random-float 360 fd 1 end to reproduce if (color = pink and random 5 = 0) [ hatch 1 [ if random 10 > 0 [set color blue] ;9 of 10 hatched turtles are made blue set age 0 ] ] end @#$#@#$#@ GRAPHICS-WINDOW 318 10 661 374 18 18 9.0 1 10 1 1 1 CC-WINDOW 10 281 306 427 Command Center BUTTON 27 220 82 253 setup setup NIL 1 T OBSERVER MONITOR 167 212 269 261 count turtles count turtles 3 1 BUTTON 86 220 141 253 go go T 1 T OBSERVER PLOT 10 10 311 195 Population time count 0.0 200.0 0.0 50.0 true false PENS "number" 1.0 0 -16776961 true @#$#@#$#@ WHAT IS IT? ----------- This code example demonstrates the HATCH command. Blue turtles never reproduce. Pink turtles have a one-in-five chance of reproducing at each time tick. Each turtle's life lasts 50 ticks. Nine out of ten baby turtles are blue. The turtles created by HATCH are exact duplicates of their parents, so it is necessary to reset each new turtle's age to 0 inside the HATCH command. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 @#$#@#$#@ NetLogo 2.0alpha1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@