Starz

TurtleAcademy learn programming for freeYour browser does not support canvasWe recommand that you use either Chrome or Firefox

Your code review

×

Share on

Average score: 3,73 Number of votes: 55 Total score: 205
Devi Accedi classificare

Basic Commands

  • fd(x) , forward(x)

    Moves the turtle x points

  • back (x) , bk(x)

    The turtle back x points

  • left(x) , lt(x)

    Rotate the turtle left x degrees

  • right(x) , rt(x)

    Rotate the turtle left x degrees

  • clearscreen, cs

    Will clear the screen and return the turtle home

Controlling the Pen

  • penup , pu

    Turtle stops leaving a trail

  • pendown , pd

    The turtle will leave a trail

  • setwaittime (x) , swt (x)

    Will set the waiting time to x milliseconds

  • wait

    Will cause the turtle to wait before executing the command

  • setwidth (x)

    Will set the pen width to X

  • hideturtle , ht

    Hide the turtle

  • showturtle , st

    Show the turtle

  • home

    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

  • setheading (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

  • repcount

    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

  • first listname

    Outputs the first item from the list

  • butfirst listname , bf listname

    Outputs all the items of listname except for the first item

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

  • setcolor (x)

    Will set the turtle color accroding to the following table

    0: black 1: blue 2: green
    3: cyan 4: red 5: magenta
    6: yellow 7: white 8: brown
    9: tan 10: green 11: aqua
    12: salmon 13: purple 14: orange
    15: gray

  • setcolor [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

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

  • Your functions