PTurtle: LOGO-like library for teachers, 17 March 2009

Phew, after a whole load of work and messing about, Ollie Glass and I have (finally) uploaded our PTurtle library!

It’s aimed at teachers and those just setting out learning programming through Processing, and was born out of a course we taught to PGDip students at the University of Brighton.

The commands are the same as classic LOGO, but being written in Java and based in Processing, allows learning from the ground up:

The complete code to draw a rectangle, using only methods of one object:

import pturtle.*;
Turtle t = new Turtle(this);
t.forward(10);
t.right(90);
t.forward(10);
t.right(90);
t.forward(10);
t.right(90);
t.forward(10);
t.right(90);

The same, but after the student has been taught loops:

import pturtle.*;
Turtle t = new Turtle(this);
for (int i = 0; i < 4; i++) {
  t.forward(10);
  t.right(90);
}

There’s convenience methods in there for just about every way you could conceive of using the Turtle, as well as an advanced HistoryTurtle class, that leaves a modifiable trail.

We’ve got tonnes of past student work which we’ll be posting up soon, please don’t hesitate to contact either Ollie or myself if you have any difficulties with the Turtle! :)


Comment

Commenting is closed for this article.