Please register and start creating your own cool programs

TurtleAcademy learn programming for freeYour browser is not supporting canvas We recomand you to use Chrome or Firefox browsers

Turtle Motion

вперёд X , вп X

Moves the turtle x points

Example:

вперёд 50

Explained in lesson:

Logo's turtle

назад X , нд X

The turtle back x points

Example:

назад 50

Explained in lesson:

Logo's turtle

налево X , лв X

Rotate the turtle left x degrees

Example:

налево 90

Explained in lesson:

Logo's turtle

направо X , пр X

Rotate the turtle right x degrees

Example:

направо 90

Explained in lesson:

Logo's turtle

домой

Moves the turtle to center, pointing upwards

Example:

домой

Explained in lesson:

Turtle world

задать_гор NUM_x

Move turtle to the specified X location

Example:

задать_гор 100

Explained in lesson:

Turtle world

задать_верт NUM_y

Move turtle to the specified Y location

Example:

задать_верт 200

Explained in lesson:

Turtle world

задать_гор_верт NUM_X NUM_Y , set pos [ NUM_X NUM_Y ]

Move turtle to the specified location

Example:

задать_гор_верт 100 100

Explained in lesson:

Turtle world

задать_курс , задать_курс

Rotate the turtle to the specified heading

Example:

sh 145

Explained in lesson:

Turtle world

дуга ANGLE RADIUS

Will create an arc distance RADIUS covering ANGLE angle

Example:

ARC 360 5

Explained in lesson:

Turtle world

ellipse WIDTH HEIGHT

Will create an ellipse with Width and height

Example:

ellipse 80 90

Turtle Motion Queries

коорд

Outputs the current turtle position as [ x y ], x or y respectively

Example:

коорд

Explained in lesson:

The turtle answer

коорд_гор

Outputs the current turtle position as [ x y ], x or y respectively

Example:

коорд_гор

Explained in lesson:

The turtle answer

коорд_верт

Outputs the current turtle position as [ x y ], x or y respectively

Example:

коорд_верт

Explained in lesson:

The turtle answer

курс

Outputs the current turtle heading

Example:

курс

Explained in lesson:

The turtle answer

направление

Outputs the heading towards the specified [ x y ] coordinates

Example:

направление

Explained in lesson:

The turtle answer

Turtle and Window Control

покажи_черепашку , пч

Show the turtle

Example:

сч ждать пч

спрячь_черепашку , сч

Hide the turtle

Example:

спрячь_черепашку

очисти , оэ

Will clear the screen

Example:

вп 60 очисти

Explained in lesson:

Logo's turtle

очисти_экран , оэ

Will clear the screen and return the turtle home

Example:

оэ

Explained in lesson:

Logo's turtle

наполнять

Does a paint bucket flood fill at the turtle's position

Example:

оэ повторить 4 [ вп 50 пр 90 ] пп задать_гор_верт 50 50 по наполнять

Explained in lesson:

Background

заполненный fillcolor [ statements ... ]

Execute statements without drawing but keeping track of turtle movements. When complete, fill the region traced by the turtle with fillcolor and outline the region with the current pen style

Example:

заполненный "blue [repeat 4 [fd 100 пр 90]]

Explained in lesson:

Background

надпись expr

Draw a word (same logic as print) on the graphics display at the turtle location

Example:

надпись "logo сч

Explained in lesson:

Background

задать_высоту_надписи expr

Set the height for text drawn by label, in pixels

Example:

задать_высоту_надписи 100 надпись "Logo сч

Explained in lesson:

Background

сворачивать

If the turtle moves off the edge of the screen it will continue on the other side

Example:

оэ сворачивать вп 800

Explained in lesson:

The turtle borders

окно

The turtle can move past the edges of the screen, unbounded.

Example:

оэ окно вп 600 пр 90 вп 100 пр 90 вп 70

Explained in lesson:

The turtle borders

изгородь

If the turtle attempts to move past the edge of the screen it will stop.

Example:

оэ изгородь вп 600 пр 90 вп 100 пр 90 вп 70

Explained in lesson:

The turtle borders

Turtle and Window Queries

shownp , shown?

Outputs 1 if the turtle is shown, 0 if the turtle is hidden

Example:

show shown?

Explained in lesson:

Interactive

labelsize

Outputs the height of text drawn by label, in pixels

Example:

show labelsize

Explained in lesson:

Interactive

Pen and Background Control

перо_подними , пп

Turtle stops leaving a trail

Example:

перо_подними

перо_опусти , по

The turtle will leave a trail

Example:

перо_опусти

задать_цвет X , задать_цвет_пера X
Will set the turtle color accroding to the following table
0: черный 1: голубой 2: лимонный
3: бирюзовый 4: красный 5: пурпурный
6: желтый 7: белый 8: коричневый
9: tg 10: зеленый 11: цвет морской волны
12: оранжево-розовый 13: фиолетовый 14: оранжевый
15: серый

Example:

задать_цвет 1

Explained in lesson:

Colors and printing

задать_цвет [r,g,b] , задать_цвет_пера [r,g,b]

Will set the turtle color accroding to the amount of red , green and blue

Example:

задать_цвет [50 100 50]

задать_ширину X , задать_толщину_пера X

Will set the pen width to X

Example:

задать_ширину 4 вп 50

Explained in lesson:

The pen width

изменитьформу X or STR , иф X or STR

0 = "черепаха", 1 = "кошка", 2 = "рыба", 3 = "собака", 4 = "лошадь", 5 = "тигр", 6 = " краб", 7 = "улитка"

Example:

иф 1 or иф "dog

Explained in lesson:

Turtle world

Pen Queries

pendownp , pendown?

Outputs 1 if the pen is down, 0 otherwise

Example:

show pendown?

Explained in lesson:

Interactive

pencolor , pc

Outputs the current pen color. This will be a CSS color string, not necessarily the value passed in.

Example:

show pencolor

Explained in lesson:

Interactive

pensize

Outputs a two element list with the pen width and height (usually the same).

Example:

show pensize

Explained in lesson:

Interactive

Procedure Definition

до PROCNAME inputs ... statements ... end

Define a new named procedure with optional inputs

Example:

до TURTLE повторить 4 [ вп 50 пр 90] конец

Explained in lesson:

The turtle is learning

define PROCNAME inputs ... statements ... end

Define a new named procedure with optional inputs

Example:

define "star [[n][repeat 5 [fd :n пр 144]]]

def PROCNAME

Outputs the definition of a named procedure as a string

Example:

show def "star

Variable Definition

создать varname expr

Update a variable or define a new global variable. The variable name must be quoted

Example:

создать "foo 5

Explained in lesson:

Variables

имя expr varname

Like make but with the inputs reversed

Example:

имя 5 "myvar

Explained in lesson:

No lesson yet

localmake varname expr

Define a variable in the local scope (shortcut for local then make

Example:

localmake "myvar 5

Explained in lesson:

No lesson yet

: VARNAME , thing VARNAME

Outputs the value of variable. :foo is a shortcut for thing "foo

Example:

show thing "myvar

Explained in lesson:

Variables

Control Structures

повторить X [ statements ... ]

Repeat statements X times

Example:

повторить 4 [ вп 50 пр 90]

Explained in lesson:

Loops

для controllist [ statements ...]

Typical for loop. The controllist specifies three or four members: the local varname, start value, limit value, and optional step size

Example:

для [i 1 10 1] [print :i]

Explained in lesson:

The for loop

число_повторов

Outputs the current iteration number of the current repeat or forever

Example:

повторить 4 [ число_повторов ]

если expr [statement]

Execute statment if expressoin is true

Example:

если 2>1 [print "hello]

если_иначе expr [statementTrue] [statementFalse]

Execute StatementTrue if tru else execute statementFalse

Example:

если_иначе 0>1 [print "true] [print "false]

test expr

Test the specified expression save the result in the local scope for the subsequent use by iftrue iffalse

Example:

test 3>4 если_истина [print "true] если_ложь [print "false]

если_истина [statements]

Example:

test 3>4 если_истина [print "true] если_ложь [print "false]

если_ложь [statements]]

Example:

test 3>4 если_истина [print "true] если_ложь [print "false]

ждать X

Will cause the turtle to wait X ( 60ths of seconds ) time before executing the command

Example:

повторить 4 [ ждать 10 вп 50]

Explained in lesson:

Hi wait

до_свидания

Ternimante the program

Example:

до_свидания

dotimes [varname times] [ statements ...]

Run the statements the specified number of times. The variable varname is set to the current iteration number.

Example:

dotimes [ i 5 ] [ show :i * :i ]

делать, пока [ statements ...] expr

Runs the specified statements at least once, and repeats while the expression is non-zero (true).

Example:

делать, пока [ создать "a случайное 10 show :a ] :a < 8

пока [expr] [ statements ...]

Runs the specified statements only while the expression remains non-zero (true).

Example:

пока (random 2) = 0 [ show "zero ] show "one

do.until [ statements ...] [expr]

Runs the specified statements at least once, and repeats while the expression is zero (false).

Example:

do.until [ создать "a случайное 10 show :a ] :a < 8

until [expr] [ statements ...]

Runs the specified statements only while the expression remains zero (false).

Example:

until (random 2) = 0 [ show "one ] show "zero

Lists

список thing1 thing2 ...

Create a new list from the inputs

Example:

создать "mylist (list "turtle "academy)

Explained in lesson:

Lists

первый listname

Outputs the first item from the list

Example:

напиши первый :mylist

Explained in lesson:

Lists

кроме_первого listname

Outputs all the items of listname except for the first item

Example:

напиши кроме_первого :mylist

Explained in lesson:

Accessing the list

последний listname

Outputs the last item from the list

Example:

напиши последний :mylist

Explained in lesson:

Lists

кроме_последнего listname

Outputs all the items of listname except for the last item

Example:

напиши кроме_последнего :mylist

Explained in lesson:

Accessing the list

элемент index listname

Outputs the indexlist item of the list or array

Example:

напиши элемент 1 :mylist

Explained in lesson:

Accessing the list

выбрать index listname

Outputs one item from a list, at random

Example:

напиши выбрать :mylist

Explained in lesson:

Accessing the list

Math

сумма X Y

Will sum x+y

Example:

напиши сумма 2 3

Explained in lesson:

Variables

минус X Y

return the distance between x and y x-y

Example:

напиши минус 8 2

случайное X

Will choose a random number between 0 - (X-1)'

Example:

оэ напиши сумма случайное 10 3

Explained in lesson:

Colors and printing

modulo expr expr

Outputs the remainder (modulus). For remainder and % the result has the same sign as the first input; for modulo the result has the same sign as a the second input.

Example:

оэ напиши modulo 10 3

power expr expr

3 power 4 = 81

Example:

show power 3 4

Receivers

читатьслово

Prompt the user for a line of input. The result (including spaces) is the single word output.

Example:

создать "name (readword [What is your name?]) show :name

Explained in lesson:

Interactive

leerlista

Prompt the user for a line of input. The result is a list of words.

Example:

создать "colors (readlist [Type some colors:]) show :colors

Predicates

word thing , слово? thing

Returns true (1) or false (0) if thing is a word

Example:

show word "hello

список? thing , список? thing

Returns true (1) or false (0) if thing is a list

Example:

напиши список? [1 2 3]

матрица? thing , матрица? thing

Returns true (1) or false (0) if thing is an array

Example:

напиши матрица? array 2

количество? thing , количество? thing

Returns true (1) or false (0) if thing is a number

Example:

напиши количество? 25

emptyp thing , empty? thing

Test if thing is an empty list or empty string.

Example:

напиши emptyp []

равный? expr expr , равный? expr expr

Test if xper expr are equal.

Example:

равный? "no "yes

неравный? expr expr , неравный? expr expr

Test if xper expr are not equal.

Example:

неравный? "no "yes

до? thing1 , до? thing1

Test string collation order.

Example:

напиши до? "bye "hi

подстрока? thing1 thing2 , подстрока? thing1 thing2

Test if thing1 is a substring of thing2.

Example:

напиши подстрока? "hello "helloworld