زمین بازی

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

In order to save your program please ورود یا register

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

envolver

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

Example:

پاک envolver ج 800

Explained in lesson:

The turtle borders

ventana

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

Example:

پاک ventana ج 600 ر 90 ج 100 ر 90 ج 70

Explained in lesson:

The turtle borders

valla

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

Example:

پاک valla ج 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: تانژانت 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

cambiarforma X or STR , cf X or STR

Will change the turtle to another shape accordin to the following 0 = "turtle", 1 = "cat", 2 = "fish", 3 = "dog", 4 = "horse", 5 = "tiger", 6 = "crab", 7 = "snail"

Example:

cf 1 or cf "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

name expr varname

Like make but with the inputs reversed

Example:

name 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

adios

Ternimante the program

Example:

adios

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 ]

do.while [ statements ...] expr

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

Example:

do.while [ بساز "a تصادفی 10 show :a ] :a < 8

while [expr] [ statements ...]

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

Example:

while (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

leerpalabra

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 , word? thing

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

Example:

show word "hello

listp thing , list? thing

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

Example:

چاپ listp [1 2 3]

arrayp thing , array? thing

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

Example:

چاپ arrayp array 2

numberp thing , number? thing

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

Example:

چاپ numberp 25

emptyp thing , empty? thing

Test if thing is an empty list or empty string.

Example:

چاپ emptyp []

equalp expr expr , equal? expr expr

Test if xper expr are equal.

Example:

equalp "no "yes

notequalp expr expr , notequal? expr expr

Test if xper expr are not equal.

Example:

notequalp "no "yes

beforep thing1 , before? thing1

Test string collation order.

Example:

چاپ before? "bye "hi

substringp thing1 thing2 , substring? thing1 thing2

Test if thing1 is a substring of thing2.

Example:

چاپ substringp "hello "helloworld