globals [centerofgrax centerofgray] turtles-own [angle nr-of-steps dist] breeds [COG center] to setup ct clearplot cc crt number ask-turtles [setshape cross setc 65 setbreed COG setnr-of-steps 0] ask-turtles [seth random 360] ask-turtles [ifelse ((pc-at 0 0) = black) [stop] [fd random 200]] end to head65-to-center startfixed-point set centerofgrax (int average-of-turtles [xcor]) set centerofgray (int average-of-turtles [ycor]) ask-COG [ setangle (int towards-nowrap centerofgrax centerofgray) seth angle setdist (distance-nowrap (centerofgrax) (centerofgray)) fd dist setnr-of-steps (nr-of-steps + dist) ] wait 1 end to head65-to-fixed ask-turtles[ hatch [setc red setbreed center setnr-of-steps 0 setangle (towards-nowrap 0 0) setdist (distance-nowrap 0 0) seth angle fd dist setnr-of-steps (nr-of-steps + dist) ]] wait 1 end to count-COG-turtles output count-COG end to count-center-turtles output count-center end to count-COG-steps output sum-of-COG [nr-of-steps] end to count-center-steps output sum-of-center [nr-of-steps] end to count-COG-steps-av output average-of-COG [nr-of-steps] end to count-center-steps-av output average-of-center [nr-of-steps] end