מגרש המשחקים

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

כדי לשמור את התכנית בבקשה להכנס או הרשם

תזוזות הצב

קדימה X , קד X

Moves the turtle x points

Example:

קדימה 50

Explained in lesson:

הצב של לוגו

אחורה X , אח X

The turtle back x points

Example:

אחורה 50

Explained in lesson:

הצב של לוגו

שמאלה X , שמ X

Rotate the turtle left x degrees

Example:

שמאלה 90

Explained in lesson:

הצב של לוגו

ימינה X , ימ X

Rotate the turtle right x degrees

Example:

ימינה 90

Explained in lesson:

הצב של לוגו

הביתה

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

שאילתות לגביי תזוזות הצב

מיקום

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

שליטה במשטח של הצב

הצגצב , הצ

הצג את הצב

Example:

הח המתן הצ

החבאצב , הח

Hide the turtle

Example:

החבאצב

נקה , נמ

Will clear the screen

Example:

קד 60 נקה

Explained in lesson:

הצב של לוגו

נקהמסך , נמ

Will clear the screen and return the turtle home

Example:

נמ

Explained in lesson:

הצב של לוגו

צבערקע

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

שאילתות לגביי שליטה במשטח הצב

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

שליטה בעט וברקע

הרםעט , הרע

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

שנהצורה X or STR , שנצו 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:

שנצו 1 or שנצו "dog

Explained in lesson:

Turtle world

שאילתות לגביי העט

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

הגדרת פרוצדורות

למד 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

הגדרת משתנים

עשה 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

מבניי שליטה

חזור 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

רשימות

רשימה thing1 thing2 ...

Create a new list from the inputs

Example:

עשה "mylist (list "turtle "academy)

Explained in lesson:

רשימות

ראשון listname

Outputs the first item from the list

Example:

הדפס ראשון :mylist

Explained in lesson:

רשימות

בליראשון 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:

רשימות

בליאחרון 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

מתמטיקה

סכום 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

קלטים

קראמילה

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

קרארשימה

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

Example:

עשה "colors (readlist [Type some colors:]) show :colors

פרדיקטים

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