User Tools

Site Tools


weblogo:commands:turtles

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

ALLTURTLES

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

CTURTLES number

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. See also LTURTLES.

Example

DRAW
CTURTLES 16
FD 100

LTURTLES

Arranges turtles in a row.

Syntax

LTURTLES number

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. See also CTURTLES.

Example

DRAW
LTURTLES 15
FD 100

SETTURTLES (SETT)

Creates a range of turtles.

Syntax

SETTURTLES number
SETT number

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 any number as input. The actual maximum of turtles depends on the speed of the computer. <product logo> Therefore, SETTURTLES sets the maximum number of turtles that you can define to 99, although you could use the DECLARE command to create more. </product> <product logopro> Logo Pro can drive around 10.000 turtles without becoming too slow. If the turtles are hidden, Logo Pro may be able to drive several more turtles. </product>

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 (SETTNAME)

Sets the name of a turtle.

Syntax

SETTURTLENAME :turtle :name

Description

TURTLE name 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 (TNAME)

Gets the name of the first active turtle.

Syntax

TURTLENAME

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 (TNAMES)

Outputs a list of all turtle names.

Syntax

TURTLENAMES

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

TURTLES

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
weblogo/commands/turtles.txt · Last modified: 2019/01/22 06:09 (external edit)