globals [centerofgrax01 centerofgray01 centerofgrax23 centerofgray23 centerofgrax45 centerofgray45 centerofgrax67 centerofgray67 centerofgrax89 centerofgray89 centerofgrax1011 centerofgray1011] turtles-own [angle nr-of-steps dist] breeds [COG center] ; COG means Center of Gravity 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 centerofgrax01 (int average-of-turtles-with [who < 2] [xcor]) set centerofgray01 (int average-of-turtles-with [who < 2] [ycor]) set centerofgrax23 (average-of-turtles-with [who < 4 and who > 1] [xcor]) set centerofgray23 (average-of-turtles-with [who < 4 and who > 1] [ycor]) set centerofgrax45 (average-of-turtles-with [who < 6 and who > 3] [xcor]) set centerofgray45 (average-of-turtles-with [who < 6 and who > 3] [ycor]) set centerofgrax67 (average-of-turtles-with [who < 8 and who > 5] [xcor]) set centerofgray67 (average-of-turtles-with [who < 8 and who > 5] [ycor]) set centerofgrax89 (average-of-turtles-with [who < 10 and who > 7] [xcor]) set centerofgray89 (average-of-turtles-with [who < 6 and who > 7] [ycor]) set centerofgrax1011 (average-of-turtles-with [who < 12 and who > 9] [xcor]) set centerofgray1011 (average-of-turtles-with [who < 12 and who > 9] [ycor]) ask-COG [ if who < 2 [ setangle (int towards-nowrap centerofgrax01 centerofgray01) seth angle setdist (distance-nowrap (centerofgrax01) (centerofgray01)) fd dist setnr-of-steps (nr-of-steps + dist)] if (who < 4 and who > 1) [ setangle (int towards-nowrap centerofgrax23 centerofgray23) seth angle setdist (distance-nowrap (centerofgrax23) (centerofgray23)) fd dist setnr-of-steps (nr-of-steps + dist)] if (who < 6 and who > 3) [ setangle (int towards-nowrap centerofgrax45 centerofgray45) seth angle setdist (distance-nowrap (centerofgrax45) (centerofgray45)) fd dist setnr-of-steps (nr-of-steps + dist)] if (who < 8 and who > 5) [ setangle (int towards-nowrap centerofgrax67 centerofgray67) seth angle setdist (distance-nowrap (centerofgrax67) (centerofgray67)) fd dist setnr-of-steps (nr-of-steps + dist)] if (who < 10 and who > 7) [ setangle (int towards-nowrap centerofgrax89 centerofgray89) seth angle setdist (distance-nowrap (centerofgrax89) (centerofgray89)) fd dist setnr-of-steps (nr-of-steps + dist)] if (who < 12 and who > 9) [ setangle (int towards-nowrap centerofgrax1011 centerofgray1011) seth angle setdist (distance-nowrap (centerofgrax1011) (centerofgray1011)) 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-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