Terrapin Resources

Creating Turtles

Create and assign turtles.

These commands handle the number of turtles, how they are created, and how to talk to them.

ALLTURTLES

A list of all turtles.

Syntax

Description

ALLTURTLES outputs a list of the names of every turtle that currently defined in Logo. ALLTURTLES is equivalent to the command EVERY “TURTLE.

Example

ALLTURTLES Result: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]

CTURTLES

Arranges turtles in a circle.

Syntax

Description

CTURTLES activates and makes visible the number of turtles specified by its input and arranges them in a circle in the center of the Graphics window.

CTURTLES creates a new set of turtles using the SETTURTLES command.

See also LTURTLES.

Example

DRAW CTURTLES 16 FD 100

LTURTLES

Arranges turtles in a row.

Syntax

Description

LTURTLES activates and makes visible the number of turtles specified by its input and arranges them in a horizontal line along the center of the Graphics window.

LTURTLES creates a new set of turtles using the SETTURTLES command.

See also CTURTLES.

Example

DRAW LTURTLES 15 FD 100

SETTURTLES

Also: SETT

Creates a range of turtles.

Syntax

Description

SETTURTLES defines the total number of turtles available. Their numbers range from 0 to the input of SETTURTLES minus 1. For example, SETTURTLES 16 will create the turtles [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]. By default, Logo starts with 16 turtles defined and turtle 0 activated.

SETTURTLES creates turtles with the following characteristics:

   
Position Home [0 0]
Turtle size 1
Heading 0
Line width 1
Color 0 (black)
Turtle speed 1
Visibility FALSE
Pattern 0
Pen state PENDOWN
Font: Default system font, 9 points

SETTURTLES accepts a number between 1 and 1000 as input. The actual maximum of turtles depends on the speed of the computer. The more turtles you set, the slower turtle movements become.

TURTLES reports the number of turtles that have been defined with SETTURTLES. Use the TELL, ASK, EACH, and WHO commands to access multiple turtles.

Example

SETTURTLES 4 TURTLES Result: 4

SETTURTLENAME

Also: SETTNAME

Sets the name of a turtle.

Syntax

Description

SETTURTLENAME sets the alias name of the widget whose object name is supplied as its first input. It also sets the widget’s TOOLTIP property. Note that the new name is an alias to the original name; you can use both the original and the alias name to address the widget.

To get the widget alias name, see TURTLENAME.

Example

SETTNAME 0 “JOE TNAME Result: JOE

TURTLENAME

Also: TNAME

Gets the name of the first active turtle.

Syntax

Description

TURTLENAME outputs the name of the first active turtle. This is also the value of its NAME property.

To set the turtle name, see SETTURTLENAME.

Example

SETTNAME 0 “JOE TNAME Result: JOE

TURTLENAMES

Also: TNAMES

Outputs a list of all turtle names.

Syntax

Description

TURTLENAMES outputs a list of the names of all turtles. Note that this list does not output turtle numbers, but names if a turtle has been given an alias name. Use ALLTURTLES to obtain a list of turtle numbers.

See also TURTLENAME and SETTURTLENAME.

Example

TURTLENAMES Result: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 JOE JACK]

TURTLES

Reports the number of turtles.

Syntax

Description

The TURTLES command reports the total number of available turtles. Set the number of turtles with SETTURTLES. See also TELLALL, ALLTURTLES, TELLEVEN, and TELLODD.

Example

TURTLES Result: 16