TURTLE' ALGORITHM

VERSION 0

Turtle starts at ZERO (the zero-th term). The facing direction is irrelevant (can be sideways).

To add the next term (it can be the first) he faces in the positive direction. To subtract the next term (take away) he faces in the negative direction.

If the next term is positive Turtle walks forward. If the next term is negative Turtle walks backwards.

Turtle's location gives the result, regardless of the facing direction.

VERSION 1

(If you want to avoid zero as the starting zero-th term):

Turtle starts at the location given by the FIRST TERM with its sign. The facing is irrelevant.

To add the next term Turtle faces in the positive direction. To subtract the next term (take away) he faces in the negative direction.

If the next term is positive Turtle walks forward. If the next term is negative Turtle walks backwards.

Turtle's location gives the result, regardless of the facing direction.

VERSION 2

as described in the Instructors Manual with Mark's following addition:

After every completed operation over the next term Turtle turns in the positive direction.

IN EACH VERSION, repeat the algorithm, again and again, as many times as needed. It works forever regardless if Turtle starts at zero or elsewhere as the result of preceding operations.

In VERSIONS 0 and 1, facing in the negative direction is equivalent to minus sign.

Comment: Starting at zero (as in Manual) means starting with zero as a term (zero-th term). In the Manual the possibility of taking away the first term from zero is missing as unnatural, because the starting term 0 was not written explicitly. That has lead to a known confusion with Turtle's facing.

The following Example shows the adequacy of 0-th term to starting at zero:

+3 +... is the same as: 0 + (+3) +...

- 3+5 is same as: 0 + (-3)+5

Case: 0 - (-3) +... is missing in Manual

Case: 0 - (+3) +... is missing in Manual