breeds [ boys girls ] to setup ;; executed once each time we press the SETUP button ca ;; clear all patches and turtles set-default-shape boys "boy-shape" create-boys boys-num ;; create BOYS-NUM number of turtles of breed BOYS ;; BOYS-NUM equals the current value of the BOYS-NUM slider set-default-shape girls "girl-shape" create-girls girls-num ;; create GIRLS-NUM number of turtles of breed GIRLS ;; GIRLS-NUM equals the current value of the GIRLS-NUM slider ask boys [ set color blue ] ask girls [ set color red ] ask turtles [ ;; includes both boys and girls setxy (random-float screen-size-x) 0 ;; disperse turtles along X axis set heading 0 ;; point all turtles up (north) ] end to move-boys ask boys [ ;; ask all turtles of breed BOYS, fd 1 ;; to move forward by 1 ] end to move-girls ask girls [ ;; ask all turtles of breed GIRLS, fd 1 ;; to move forward by 1 ] end to kill-boys ask boys [ ;; ask all turtles of breed BOYS die ;; to die ] end to kill-girls ask girls [ ;; ask all turtles of breed GIRLS die ;; to die ] end @#$#@#$#@ GRAPHICS-WINDOW 272 10 672 431 6 6 30.0 1 10 1 1 1 CC-WINDOW 9 263 261 400 Command Center BUTTON 138 191 255 229 Girls Disappear kill-girls NIL 1 T OBSERVER T BUTTON 12 191 122 229 Boys Disappear kill-boys NIL 1 T OBSERVER T BUTTON 138 142 227 180 NIL move-girls NIL 1 T OBSERVER T BUTTON 43 142 122 181 NIL move-boys NIL 1 T OBSERVER T BUTTON 27 10 219 46 setup setup NIL 1 T OBSERVER T SLIDER 6 103 243 136 girls-num girls-num 0 5 5 1 1 NIL SLIDER 5 62 243 95 boys-num boys-num 0 5 5 1 1 NIL @#$#@#$#@ WHAT IS IT? ----------- This code example shows how to create and control groups of turtles, i.e. breeds. It also shows how to set the default shape of a breed, so all turtles with that breed will have that shape. If you want to create your own shapes, press the SHAPES button on the right-hand side of the toolbar, click the "New" button, and draw your own shape! @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 boy-shape false 0 Circle -7566196 true true 107 15 84 Line -7566196 true 150 75 150 224 Line -7566196 true 150 150 74 135 Line -7566196 true 150 149 224 135 Line -7566196 true 150 224 195 284 Line -7566196 true 150 226 105 284 girl-shape false 0 Circle -7566196 true true 107 15 84 Line -7566196 true 150 75 150 224 Line -7566196 true 150 150 74 135 Line -7566196 true 150 149 224 135 Line -7566196 true 150 224 195 284 Line -7566196 true 150 226 105 284 Polygon -7566196 true true 150 99 105 267 195 267 @#$#@#$#@ NetLogo 2.0beta4 @#$#@#$#@ setup repeat 2 [ move-girls ] @#$#@#$#@ @#$#@#$#@