Try now in the
Open Cloud »
(no sign-in required)

Tangled Turtle

Find the paths for a simulated turtle that turns more at each step.

Run the code to make a table of increasing angles. Try other step sizes:

SHOW/HIDE DETAILS

Make a list of angles from 0 to 120 degrees in steps of 30 degrees:

In[1]:=
X
Out[1]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Find the path taken by a series of steps at these successive angles. Try other step sizes:

SHOW/HIDE DETAILS

This gives the sequence of points encountered by starting at {0,0} headed east, turning 0°, moving 1 unit, turning 30°, moving 1 unit, turning 60°, moving 1 unit, etc.:

In[1]:=
X
Out[1]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Draw the path:

SHOW/HIDE DETAILS

Draw a line through the points along the path. This is sometimes referred to as turtle geometry, since you can think of it as the path taken by a turtle that follows a sequence of (turn, move) instructions:

In[1]:=
X
Out[1]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Use 5° increments. Try smaller and larger ones:

SHOW/HIDE DETAILS

Using a smaller increment gives a path with more segments and whose angle changes more slowly, giving a smooth spiral at the beginning:

In[1]:=
X
Out[1]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Try increasing the maximum angle. Try other maxima:

SHOW/HIDE DETAILS

Increasing the maximum angle gives a longer path... up to a point. Eventually this path retraces itself:

In[1]:=
X
Out[1]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Make an interactive version. Drag the sliders to change the path shape:

SHOW/HIDE DETAILS

This is the code to draw a path up to a maximum angle of 1,000:

In[1]:=
X
Out[1]=

Make the code interactive by wrapping the expression with Manipulate, replacing the fixed value 1000 with the variable max, and specifying that max varies from 100 to 5000. Drag the slider to change the maximum angle:

In[2]:=
X
Out[2]=

Add a second control for the step size, and let it vary from 5 to 6:

In[3]:=
X
Out[3]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Share ItMake an interactive turtle website:

SHOW/HIDE DETAILS

Deploy the Manipulate to the Wolfram Cloud where anyone with a browser can use it:

In[1]:=
X
Out[1]=

Click the link in the output to visit the site.

Share the link by right-clicking it and choosing Copy Address. Paste the link into an email, tweet, or other message.

HIDE DETAILS
In[1]:=
X
Out[1]=