# The universe of turtles

This is an adaptation of LOGO for the Programmer's Learning Machine.

It is directly inspired from the work of the mathematician Seymour Papert in the 60's. Inspired from the swiss psycholog Jean Piaget, he came up with a learning method called LOGO to teach programming to young childs. The world is full of turtles which leave a painting where they go and which respond to simple orders.

## Functions to move the turtle

    [!java|c]void [/!]forward([!java|c]double [/!]steps[!scala]:Double[/!])
    [!java|c]void [/!]backward([!java|c]double [/!]steps[!scala]:Double[/!])

Moves forward or backward of the requested amount of steps.

    [!java|c]void [/!]right([!java|c]double [/!]angle[!scala]:Double[/!])
    [!java|c]void [/!]left([!java|c]double [/!]angle[!scala]:Double[/!])

Turns left or right of the given angle (in degrees).

    [!java|c]double [/!]getX()[!scala]:Double[/!]
    [!java|c]double [/!]getY()[!scala]:Double[/!]

Returns the current position of the turtle. Note that the point (0,0) is on the top left corner, as it is often the case in Computer Science.

    [!java|c]void [/!]setX([!java|c]double [/!]x[!scala]:Double[/!])
    [!java|c]void [/!]setY([!java|c]double [/!]y[!scala]:Double[/!])
    [!java|c]void [/!]setPos([!java|c]double [/!]x[!scala]:Double[/!], [!java|c]double [/!]y[!scala]:Double[/!])

Teleports the turtle to a new position (without leaving any trace).

    [!java|c]void [/!]moveTo([!java|c]double [/!]x[!scala]:Double[/!], [!java|c]double [/!]y[!scala]:Double[/!])

Moves the turtle to a new position.

    [!java|c]void [/!]circle([!java|c]double [/!]radius[!scala]:Double[/!])

Draw a circle of the specified radius centered on the turtle.

    [!java|c]void [/!]hide()

Hides the turtle.

    [!java|c]void [/!]show()

Shows the turtle back.

    [!java]boolean [/!][!c]int [/!]isVisible()[!scala]:Boolean[/!]

Returns whether the turtle is currently visible.

    [!java|c]void [/!]clear()

Removes any trail on the sheet.

    [!java|c]double [/!]getHeading()[!scala]:Double[/!]

Returns the current heading of the turtle (in degrees).

    [!java|c]void [/!]setHeading([!java|c]double [/!]angle[!scala]:Double[/!])

Sets a new heading to the turtle (in degrees).

## Functions about the pen

    [!java|c]void [/!]penUp()

Moves the pen up (turtles have pens, not brushes as buggles). The turtle will not leave any trace during its subsequent moves.

    [!java|c]void [/!]penDown()

Moves the pen down. The turtle will leave a trace during its subsequent moves.

    [!java]boolean [/!][!c]int [/!]isPenDown()[!scala]:Boolean[/!]

Returns the current pen position as a boolean.

    [!java|c]Color [/!]getColor()[!scala]:Color[/!]

Returns the current pen color.

    [!java|c]void [/!]setColor([!java|c]Color [/!]color[!scala]:Color[/!])

Changes the pen color.

## Other functions

    [!java]boolean [/!][!c]int [/!]isSelected()[!scala]:Boolean[/!]

Returns whether the current turtle is selected in the graphical interface.

## Valid colors

Name | Color
[!scala|java|python]Color.[/!]black |
[!scala|java|python]Color.[/!]blue |
[!scala|java|python]Color.[/!]cyan |
[!scala|java|python]Color.[/!]darkGray |
[!scala|java|python]Color.[/!]gray |
[!scala|java|python]Color.[/!]green |
[!scala|java|python]Color.[/!]lightGray |
[!scala|java|python]Color.[/!]magenta |
[!scala|java|python]Color.[/!]orange |
[!scala|java|python]Color.[/!]pink |
[!scala|java|python]Color.[/!]red |
[!scala|java|python]Color.[/!]white |
[!scala|java|python]Color.[/!]yellow |