A.10 Multiturtle Mode

It’s possible to have several active turtles on the screen. By default, on Xlogo startup, only one turtle is available. Its number is 0. If you want to "create" a new turtle, you can use the primitive setturtle followed by the number of the turtle. To prevent obstruction, the turtle is created on the origin and is invisible (you must use showturtle to show it). Then, the new turtle is the active turtle, it obeys all classic primitives while you don’t change the active turtle with setturtle. The maximum number of available turtles can be set in menu Options - Preferences - Tab options.



Here are the primitives for the multiturtle mode:



setturtle, sturtle n



The turtle numero n is now the active turtle. By default on Xlogo startup the active turtle is the number 0.



turtle



Returns the number of the active turtle.



turtles



Returns a list which contains all the numero af the turtles actually on the screen.



eraseturtle, ert n



Delete the turtle number n



setTM, setturtlesmax n



Set the maximum number of turtles for multiturtle mode.



tm, turtlesmax



Returns the maximum number of turtles for multiturtle mode.