Useful primitives


Command Outcome Example

FD < number>

Moves the turtle forward

FD 40

BK < number>

Moves the turtle backward

BK 30

LT < number>

Turns the turtle left by the number of degrees

LT 245

RT < number>

Turns the turtle right by the number of degrees

RT 37

PU

Lifts the pen up

 

PD

Puts the pen down

 

HT

Hides the turtle

 

ST

Shows the turtle

 

CS

Clears the screen

 

CT

Clears text

 

REPEAT < number>

Repeats instructions in square brackets the number of times given

REPEAT 5 [FD 30 RT 72]

SETPENCOLOR <number>

Sets the pen colour. The number has to be in the range 1-15 or you can use the command in the form:

SETPC [n m p] (a list of three integers representing the amount of Red, Greed, Blue each in the range 0-255).

SETPC 8
SETFLOODCOLOR <number> Sets the flood colour you wish to fill a space with. Similar structure to SETPC. SETFC 4
FILL Fills your space with the chosen flood colour. Note that you must be in the space with the pen down.