Please register and start creating your own cool programs
Turtle Motion
nalavo X , nl X
Rotate the turtle left x degrees
Example:
nalavo 90
Explained in lesson:
napravo X , np X
Rotate the turtle right x degrees
Example:
napravo 90
Explained in lesson:
nechx NUM_x
Move turtle to the specified X location
Example:
nechx 100
Explained in lesson:
nechy NUM_y
Move turtle to the specified Y location
Example:
nechy 200
Explained in lesson:
nechxy NUM_X NUM_Y , set pos [ NUM_X NUM_Y ]
Move turtle to the specified location
Example:
nechxy 100 100
Explained in lesson:
nechuholpohladu , nup
Rotate the turtle to the specified heading
Example:
sh 145
Explained in lesson:
obluk ANGLE RADIUS
Will create an arc distance RADIUS covering ANGLE angle
Example:
ARC 360 5
Explained in lesson:
ellipse WIDTH HEIGHT
Will create an ellipse with Width and height
Example:
ellipse 80 90
Turtle Motion Queries
poz
Outputs the current turtle position as [ x y ], x or y respectively
Example:
poz
Explained in lesson:
xsur
Outputs the current turtle position as [ x y ], x or y respectively
Example:
xsur
Explained in lesson:
ysur
Outputs the current turtle position as [ x y ], x or y respectively
Example:
ysur
Explained in lesson:
smerovanie
Outputs the current turtle heading
Example:
smerovanie
Explained in lesson:
smeromk
Outputs the heading towards the specified [ x y ] coordinates
Example:
smeromk
Explained in lesson:
Turtle and Window Control
ukazkorytnacku , uk
Show the turtle
Example:
sk cakaj uk
Explained in lesson:
skrykorytnacku , sk
Hide the turtle
Example:
skrykorytnacku
Explained in lesson:
vycistitobrazovku , vo
Will clear the screen and return the turtle home
Example:
vo
Explained in lesson:
vypln
Does a paint bucket flood fill at the turtle's position
Example:
vo opakuj 4 [ dp 50 np 90 ] ph nechxy 50 50 pd vypln
Explained in lesson:
vyplnene 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:
vyplnene "blue [repeat 4 [fd 100 np 90]]
Explained in lesson:
oznac expr
Draw a word (same logic as print) on the graphics display at the turtle location
Example:
oznac "logo sk
Explained in lesson:
nechvelkoststitku expr
Set the height for text drawn by label, in pixels
Example:
nechvelkoststitku 100 oznac "Logo sk
Explained in lesson:
obal
If the turtle moves off the edge of the screen it will continue on the other side
Example:
vo obal dp 800
Explained in lesson:
okno
The turtle can move past the edges of the screen, unbounded.
Example:
vo okno dp 600 np 90 dp 100 np 90 dp 70
Explained in lesson:
plot
If the turtle attempts to move past the edge of the screen it will stop.
Example:
vo plot dp 600 np 90 dp 100 np 90 dp 70
Explained in lesson:
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:
labelsize
Outputs the height of text drawn by label, in pixels
Example:
show labelsize
Explained in lesson:
Pen and Background Control
perohore , ph
Turtle stops leaving a trail
Example:
perohore
Explained in lesson:
perodole , pd
The turtle will leave a trail
Example:
perodole
Explained in lesson:
nechfarba X , nechfarbapera X
0: black | 1: blue | 2: lime |
3: cyan | 4: red | 5: magenta |
6: yellow | 7: white | 8: brown |
9: tan | 10: green | 11: aquamarine |
12: salmon | 13: purple | 14: orange |
15: gray |
Example:
nechfarba 1
Explained in lesson:
nechfarba [r,g,b] , nechfarbapera [r,g,b]
Will set the turtle color accroding to the amount of red , green and blue
Example:
nechfarba [50 100 50]
nechsirka X , nechsirkapera X
Will set the pen width to X
Example:
nechsirka 4 dp 50
Explained in lesson:
zmentvar X or STR , zt 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:
zt 1 or zt "dog
Explained in lesson:
Pen Queries
pendownp , pendown?
Outputs 1 if the pen is down, 0 otherwise
Example:
show pendown?
Explained in lesson:
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:
pensize
Outputs a two element list with the pen width and height (usually the same).
Example:
show pensize
Explained in lesson:
Procedure Definition
k PROCNAME inputs ... statements ... end
Define a new named procedure with optional inputs
Example:
k TURTLE opakuj 4 [ dp 50 np 90] koniec
Explained in lesson:
define PROCNAME inputs ... statements ... end
Define a new named procedure with optional inputs
Example:
define "star [[n][repeat 5 [fd :n np 144]]]
def PROCNAME
Outputs the definition of a named procedure as a string
Example:
show def "star
Variable Definition
urob varname expr
Update a variable or define a new global variable. The variable name must be quoted
Example:
urob "foo 5
Explained in lesson:
meno expr varname
Like make but with the inputs reversed
Example:
meno 5 "myvar
Explained in lesson:
localmake varname expr
Define a variable in the local scope (shortcut for local then make
Example:
localmake "myvar 5
Explained in lesson:
: VARNAME , thing VARNAME
Outputs the value of variable. :foo is a shortcut for thing "foo
Example:
show thing "myvar
Explained in lesson:
Control Structures
opakuj X [ statements ... ]
Repeat statements X times
Example:
opakuj 4 [ dp 50 np 90]
Explained in lesson:
for controllist [ statements ...]
Typical for loop. The controllist specifies three or four members: the local varname, start value, limit value, and optional step size
Example:
for [i 1 10 1] [print :i]
Explained in lesson:
oppocet
Outputs the current iteration number of the current repeat or forever
Example:
opakuj 4 [ oppocet ]
if expr [statement]
Execute statment if expressoin is true
Example:
if 2>1 [print "hello]
ifelse expr [statementTrue] [statementFalse]
Execute StatementTrue if tru else execute statementFalse
Example:
ifelse 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 iftrue [print "true] iffalse [print "false]
iftrue [statements]
Example:
test 3>4 iftrue [print "true] iffalse [print "false]
iffalse [statements]]
Example:
test 3>4 iftrue [print "true] iffalse [print "false]
cakaj X
Will cause the turtle to wait X ( 60ths of seconds ) time before executing the command
Example:
opakuj 4 [ cakaj 10 dp 50]
Explained in lesson:
ahoj
Ternimante the program
Example:
ahoj
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 ]
rob.pocas [ statements ...] expr
Runs the specified statements at least once, and repeats while the expression is non-zero (true).
Example:
rob.pocas [ urob "a nahodne 10 show :a ] :a < 8
pocas [expr] [ statements ...]
Runs the specified statements only while the expression remains non-zero (true).
Example:
pocas (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 [ urob "a nahodne 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
zoznam thing1 thing2 ...
Create a new list from the inputs
Example:
urob "mylist (list "turtle "academy)
Explained in lesson:
prvy listname
Outputs the first item from the list
Example:
tlac prvy :mylist
Explained in lesson:
aleprve listname
Outputs all the items of listname except for the first item
Example:
tlac aleprve :mylist
Explained in lesson:
posledny listname
Outputs the last item from the list
Example:
tlac posledny :mylist
Explained in lesson:
aleposledne listname
Outputs all the items of listname except for the last item
Example:
tlac aleposledne :mylist
Explained in lesson:
predmet index listname
Outputs the indexlist item of the list or array
Example:
tlac predmet 1 :mylist
Explained in lesson:
vybrat index listname
Outputs one item from a list, at random
Example:
tlac vybrat :mylist
Explained in lesson:
Math
minus X Y
return the distance between x and y x-y
Example:
tlac minus 8 2
nahodne X
Will choose a random number between 0 - (X-1)'
Example:
vo tlac suma nahodne 10 3
Explained in lesson:
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:
vo tlac modulo 10 3
power expr expr
3 power 4 = 81
Example:
show power 3 4
Receivers
citajslovo
Prompt the user for a line of input. The result (including spaces) is the single word output.
Example:
urob "name (readword [What is your name?]) show :name
Explained in lesson:
citajzoznam
Prompt the user for a line of input. The result is a list of words.
Example:
urob "colors (readlist [Type some colors:]) show :colors
Predicates
word thing , slovo? thing
Returns true (1) or false (0) if thing is a word
Example:
show word "hello
zoznamp thing , zoznam? thing
Returns true (1) or false (0) if thing is a list
Example:
tlac zoznamp [1 2 3]
zoskupitp thing , zoskupit? thing
Returns true (1) or false (0) if thing is an array
Example:
tlac zoskupitp array 2
cislop thing , cislo? thing
Returns true (1) or false (0) if thing is a number
Example:
tlac cislop 25
emptyp thing , empty? thing
Test if thing is an empty list or empty string.
Example:
tlac emptyp []
rovnap expr expr , rovna? expr expr
Test if xper expr are equal.
Example:
rovnap "no "yes
nerovnap expr expr , nerovna? expr expr
Test if xper expr are not equal.
Example:
nerovnap "no "yes
predtymp thing1 , predtym? thing1
Test string collation order.
Example:
tlac predtym? "bye "hi
podretazecp thing1 thing2 , podretazec? thing1 thing2
Test if thing1 is a substring of thing2.
Example:
tlac podretazecp "hello "helloworld