Please register and start creating your own cool programs

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

Basic Commands

  • 前(x), 向前(x)

    Moves the turtle x points

  • 向后 (x) , 后 (x)

    The turtle back x points

  • 向左(x) , 左 (x)

    Rotate the turtle left x degrees

  • 向右(x) , 右(x)

    Rotate the turtle left x degrees

  • 清屏, 清屏

    Will clear the screen and return the turtle home

Controlling the Pen

  • 提笔, 提笔

    Turtle stops leaving a trail

  • 放笔, 放笔

    The turtle will leave a trail

  • 设置宽度(x), 显示海龟 (x)

    Will set the waiting time to x milliseconds

  • Will cause the turtle to wait before executing the command

  • 设置宽度(x)

    Will set the pen width to X

  • 隐藏海龟, 隐藏海龟

    Hide the turtle

  • 显示海龟, 显示海龟

    Show the turtle

  • 复位

    Moves the turtle to center, pointing upwards

  • setx(num), sety(num)

    Move turtle to the specified location

  • setxy (num1,num2)

    Move turtle to the specified location

  • 设置前进方向(x), seth (x)

    Rotate the turtle to the specified heading

  • arc (ANGLE, RADIUS)

    Will create an arc distance RADIUS covering ANGLE angle

  • ellipse (Width , Height)

    Will craete an ellipse width Width and height Height

  • pos, xcor, ycor

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

  • heading

    Outputs the current turtle heading

  • towards

    Outputs the heading towards the specified [ x y ] coordinates

Loops and procedure

  • repeat x [ statements ... ]

    Repeat statements x times

  • 重复次数

    Outputs the current iteration number of the current repeat or forever

  • for controllist [ statements ...]

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

  • to PROCNAME inputs ... statements ... end

    Define a new named procedure with optional inputs

  • make varname expr

    Update a variable or define a new global variable. The variable name must be quoted, e.g. make 'foo 5

  • : VARNAME

    access the content of VARNAME

Lists

  • list thing1 thing2 ...

    Create a new list from the inputs

  • 第一个 listname

    Outputs the first item from the list

  • butfirst listname , bf listname

    Outputs all the items of listname except for the first item

  • 最后一个 listname

    Outputs the last item from the list

  • butlast listname

    Outputs all the items of listname except for the last item

  • item index list

    Outputs the indexlist item of the list or array

  • pick listname

    Outputs one item from a list, at random

Colors

  • 设置颜色(x)

    Will set the turtle color accroding to the following table

    0: 黑色 1: 蓝色 2: 绿色
    3: 青色 4: 结束 5: 紫红色
    6: 您好 7: 白色 8: 棕色
    9: tan 10: 绿色 11: aqua
    12: 浅橙色 13: 紫色 14: 橙色
    15: 灰色

  • 设置颜色 [r,g,b]

    Will set the turtle color accroding to the amount of red , green and blue for example setcolor [50 100 50]

  • fill

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

  • filled 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

Math

  • sum x y

    sum x y

  • minus x y

    return the distance between x and y

  • 随机(x)

    Will choose a random number between 0 - (x-1)

  • 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.